Skip to content

Commit 8fc877f

Browse files
authored
Merge pull request #22117 from nextcloud/activity-settings-grouping
allow grouping of activity settings
2 parents 5d3ecfd + 227e362 commit 8fc877f

File tree

14 files changed

+97
-98
lines changed

14 files changed

+97
-98
lines changed

apps/files/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'OCA\\Files\\Activity\\Helper' => $baseDir . '/../lib/Activity/Helper.php',
1313
'OCA\\Files\\Activity\\Provider' => $baseDir . '/../lib/Activity/Provider.php',
1414
'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir . '/../lib/Activity/Settings/FavoriteAction.php',
15+
'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => $baseDir . '/../lib/Activity/Settings/FileActivitySettings.php',
1516
'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir . '/../lib/Activity/Settings/FileChanged.php',
1617
'OCA\\Files\\Activity\\Settings\\FileCreated' => $baseDir . '/../lib/Activity/Settings/FileCreated.php',
1718
'OCA\\Files\\Activity\\Settings\\FileDeleted' => $baseDir . '/../lib/Activity/Settings/FileDeleted.php',

apps/files/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ComposerStaticInitFiles
2727
'OCA\\Files\\Activity\\Helper' => __DIR__ . '/..' . '/../lib/Activity/Helper.php',
2828
'OCA\\Files\\Activity\\Provider' => __DIR__ . '/..' . '/../lib/Activity/Provider.php',
2929
'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__ . '/..' . '/../lib/Activity/Settings/FavoriteAction.php',
30+
'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileActivitySettings.php',
3031
'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileChanged.php',
3132
'OCA\\Files\\Activity\\Settings\\FileCreated' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileCreated.php',
3233
'OCA\\Files\\Activity\\Settings\\FileDeleted' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileDeleted.php',

apps/files/lib/Activity/Settings/FavoriteAction.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,7 @@
2323

2424
namespace OCA\Files\Activity\Settings;
2525

26-
use OCP\Activity\ISetting;
27-
use OCP\IL10N;
28-
29-
class FavoriteAction implements ISetting {
30-
31-
/** @var IL10N */
32-
protected $l;
33-
34-
/**
35-
* @param IL10N $l
36-
*/
37-
public function __construct(IL10N $l) {
38-
$this->l = $l;
39-
}
40-
26+
class FavoriteAction extends FileActivitySettings {
4127
/**
4228
* @return string Lowercase a-z and underscore only identifier
4329
* @since 11.0.0
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl>
7+
*
8+
* @license GNU AGPL version 3 or any later version
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Affero General Public License as
12+
* published by the Free Software Foundation, either version 3 of the
13+
* License, or (at your option) any later version.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*
23+
*/
24+
25+
namespace OCA\Files\Activity\Settings;
26+
27+
use OCP\Activity\ActivitySettings;
28+
use OCP\IL10N;
29+
30+
abstract class FileActivitySettings extends ActivitySettings {
31+
/** @var IL10N */
32+
protected $l;
33+
34+
/**
35+
* @param IL10N $l
36+
*/
37+
public function __construct(IL10N $l) {
38+
$this->l = $l;
39+
}
40+
41+
public function getGroupIdentifier() {
42+
return 'files';
43+
}
44+
45+
public function getGroupName() {
46+
return $this->l->t('Files');
47+
}
48+
}

apps/files/lib/Activity/Settings/FileChanged.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,7 @@
2323

2424
namespace OCA\Files\Activity\Settings;
2525

26-
use OCP\Activity\ISetting;
27-
use OCP\IL10N;
28-
29-
class FileChanged implements ISetting {
30-
31-
/** @var IL10N */
32-
protected $l;
33-
34-
/**
35-
* @param IL10N $l
36-
*/
37-
public function __construct(IL10N $l) {
38-
$this->l = $l;
39-
}
40-
26+
class FileChanged extends FileActivitySettings {
4127
/**
4228
* @return string Lowercase a-z and underscore only identifier
4329
* @since 11.0.0

apps/files/lib/Activity/Settings/FileCreated.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,7 @@
2323

2424
namespace OCA\Files\Activity\Settings;
2525

26-
use OCP\Activity\ISetting;
27-
use OCP\IL10N;
28-
29-
class FileCreated implements ISetting {
30-
31-
/** @var IL10N */
32-
protected $l;
33-
34-
/**
35-
* @param IL10N $l
36-
*/
37-
public function __construct(IL10N $l) {
38-
$this->l = $l;
39-
}
40-
26+
class FileCreated extends FileActivitySettings {
4127
/**
4228
* @return string Lowercase a-z and underscore only identifier
4329
* @since 11.0.0

apps/files/lib/Activity/Settings/FileDeleted.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,7 @@
2323

2424
namespace OCA\Files\Activity\Settings;
2525

26-
use OCP\Activity\ISetting;
27-
use OCP\IL10N;
28-
29-
class FileDeleted implements ISetting {
30-
31-
/** @var IL10N */
32-
protected $l;
33-
34-
/**
35-
* @param IL10N $l
36-
*/
37-
public function __construct(IL10N $l) {
38-
$this->l = $l;
39-
}
40-
26+
class FileDeleted extends FileActivitySettings {
4127
/**
4228
* @return string Lowercase a-z and underscore only identifier
4329
* @since 11.0.0

apps/files/lib/Activity/Settings/FileFavorite.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,7 @@
2323

2424
namespace OCA\Files\Activity\Settings;
2525

26-
use OCP\Activity\ISetting;
27-
use OCP\IL10N;
28-
29-
class FileFavorite implements ISetting {
30-
31-
/** @var IL10N */
32-
protected $l;
33-
34-
/**
35-
* @param IL10N $l
36-
*/
37-
public function __construct(IL10N $l) {
38-
$this->l = $l;
39-
}
40-
26+
class FileFavorite extends FileActivitySettings {
4127
/**
4228
* @return string Lowercase a-z and underscore only identifier
4329
* @since 11.0.0

apps/files/lib/Activity/Settings/FileRestored.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,7 @@
2323

2424
namespace OCA\Files\Activity\Settings;
2525

26-
use OCP\Activity\ISetting;
27-
use OCP\IL10N;
28-
29-
class FileRestored implements ISetting {
30-
31-
/** @var IL10N */
32-
protected $l;
33-
34-
/**
35-
* @param IL10N $l
36-
*/
37-
public function __construct(IL10N $l) {
38-
$this->l = $l;
39-
}
40-
26+
class FileRestored extends FileActivitySettings {
4127
/**
4228
* @return string Lowercase a-z and underscore only identifier
4329
* @since 11.0.0

lib/private/Activity/ActivitySettingsAdapter.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@
2525

2626
use OCP\Activity\ActivitySettings;
2727
use OCP\Activity\ISetting;
28+
use OCP\IL10N;
2829

2930
/**
3031
* Adapt the old interface based settings into the new abstract
3132
* class based one
3233
*/
3334
class ActivitySettingsAdapter extends ActivitySettings {
3435
private $oldSettings;
36+
private $l10n;
3537

36-
public function __construct(ISetting $oldSettings) {
38+
public function __construct(ISetting $oldSettings, IL10N $l10n) {
3739
$this->oldSettings = $oldSettings;
40+
$this->l10n = $l10n;
3841
}
3942

4043
public function getIdentifier() {
@@ -45,6 +48,14 @@ public function getName() {
4548
return $this->oldSettings->getName();
4649
}
4750

51+
public function getGroupIdentifier() {
52+
return 'other';
53+
}
54+
55+
public function getGroupName() {
56+
return $this->l10n->t('Other activities');
57+
}
58+
4859
public function getPriority() {
4960
return $this->oldSettings->getPriority();
5061
}

0 commit comments

Comments
 (0)