From 3938052b7ddf515b79d9ed275fbb55e7f452bed1 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Thu, 1 Aug 2024 09:28:26 +0200 Subject: [PATCH] fix(activity): regroup Files and spltit sharing activity Signed-off-by: skjnldsv --- apps/comments/lib/Activity/Setting.php | 12 ++++++-- .../Settings/ShareActivitySettings.php | 4 +-- apps/systemtags/lib/Activity/Setting.php | 30 ++++++++++++------- .../Activity/ActivitySettingsAdapter.php | 10 +++---- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/apps/comments/lib/Activity/Setting.php b/apps/comments/lib/Activity/Setting.php index cc7c47784ac6e..9315aedc10441 100644 --- a/apps/comments/lib/Activity/Setting.php +++ b/apps/comments/lib/Activity/Setting.php @@ -5,10 +5,10 @@ */ namespace OCA\Comments\Activity; -use OCP\Activity\ISetting; +use OCP\Activity\ActivitySettings; use OCP\IL10N; -class Setting implements ISetting { +class Setting extends ActivitySettings { public function __construct( protected IL10N $l, ) { @@ -22,6 +22,14 @@ public function getName(): string { return $this->l->t('Comments for files'); } + public function getGroupIdentifier() { + return 'files'; + } + + public function getGroupName() { + return $this->l->t('Files'); + } + public function getPriority(): int { return 50; } diff --git a/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php b/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php index 5a46a5cbd0262..e8547324f244e 100644 --- a/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php +++ b/apps/files_sharing/lib/Activity/Settings/ShareActivitySettings.php @@ -23,10 +23,10 @@ public function __construct(IL10N $l) { } public function getGroupIdentifier() { - return 'files'; + return 'sharing'; } public function getGroupName() { - return $this->l->t('Files'); + return $this->l->t('Sharing'); } } diff --git a/apps/systemtags/lib/Activity/Setting.php b/apps/systemtags/lib/Activity/Setting.php index 92e9ee6639248..5f03d348235fc 100644 --- a/apps/systemtags/lib/Activity/Setting.php +++ b/apps/systemtags/lib/Activity/Setting.php @@ -5,19 +5,11 @@ */ namespace OCA\SystemTags\Activity; -use OCP\Activity\ISetting; +use OCP\Activity\ActivitySettings; use OCP\IL10N; -class Setting implements ISetting { - - /** @var IL10N */ - protected $l; - - /** - * @param IL10N $l - */ - public function __construct(IL10N $l) { - $this->l = $l; +class Setting extends ActivitySettings { + public function __construct(protected IL10N $l) { } /** @@ -36,6 +28,22 @@ public function getName() { return $this->l->t('System tags for a file have been modified'); } + /** + * @return string Lowercase a-z and underscore only group identifier + * @since 20.0.0 + */ + public function getGroupIdentifier() { + return 'files'; + } + + /** + * @return string A translated string for the settings group + * @since 20.0.0 + */ + public function getGroupName() { + return $this->l->t('Files'); + } + /** * @return int whether the filter should be rather on the top or bottom of * the admin section. The filters are arranged in ascending order of the diff --git a/lib/private/Activity/ActivitySettingsAdapter.php b/lib/private/Activity/ActivitySettingsAdapter.php index bc0e60c1acb37..5579685ccb82f 100644 --- a/lib/private/Activity/ActivitySettingsAdapter.php +++ b/lib/private/Activity/ActivitySettingsAdapter.php @@ -17,12 +17,10 @@ * class based one */ class ActivitySettingsAdapter extends ActivitySettings { - private $oldSettings; - private $l10n; - - public function __construct(ISetting $oldSettings, IL10N $l10n) { - $this->oldSettings = $oldSettings; - $this->l10n = $l10n; + public function __construct( + private ISetting $oldSettings, + private IL10N $l10n + ) { } public function getIdentifier() {