From 397343e53688787d6bdbdfa949171cf2bdb6c6f4 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 19 Jul 2016 18:26:19 +0200 Subject: [PATCH] Activities: Enable Limit on favorites for Mail. Before it was only possible to limit that for the stream. Fixes owncloud/enterprise#1430 --- apps/files/lib/Activity.php | 8 +++----- apps/files/tests/ActivityTest.php | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/files/lib/Activity.php b/apps/files/lib/Activity.php index 7505205fe480..510d6a7de8c6 100644 --- a/apps/files/lib/Activity.php +++ b/apps/files/lib/Activity.php @@ -105,10 +105,7 @@ public function getNotificationTypes($languageCode) { return [ self::TYPE_SHARE_CREATED => (string) $l->t('A new file or folder has been created'), self::TYPE_SHARE_CHANGED => (string) $l->t('A file or folder has been changed'), - self::TYPE_FAVORITES => [ - 'desc' => (string) $l->t('Limit notifications about creation and changes to your favorite files (Stream only)'), - 'methods' => [self::METHOD_STREAM], - ], + self::TYPE_FAVORITES => (string) $l->t('Limit notifications about creation and changes to your favorite files'), self::TYPE_SHARE_DELETED => (string) $l->t('A file or folder has been deleted'), self::TYPE_SHARE_RESTORED => (string) $l->t('A file or folder has been restored'), ]; @@ -420,6 +417,7 @@ public function getQueryForFilter($filter) { * @return bool */ protected function userSettingFavoritesOnly($user) { - return (bool) $this->config->getUserValue($user, 'activity', 'notify_' . self::METHOD_STREAM . '_' . self::TYPE_FAVORITES, false); + return (bool)$this->config->getUserValue($user, 'activity', 'notify_' . self::METHOD_STREAM . '_' . self::TYPE_FAVORITES, false) || + (bool)$this->config->getUserValue($user, 'activity', 'notify_' . self::METHOD_MAIL . '_' . self::TYPE_FAVORITES, false); } } diff --git a/apps/files/tests/ActivityTest.php b/apps/files/tests/ActivityTest.php index 1f7fb65ab09a..b341e1710a74 100644 --- a/apps/files/tests/ActivityTest.php +++ b/apps/files/tests/ActivityTest.php @@ -118,6 +118,7 @@ public function testNotificationTypes() { $this->assertArrayHasKey(Activity::TYPE_SHARE_CREATED, $result); $this->assertArrayHasKey(Activity::TYPE_SHARE_CHANGED, $result); $this->assertArrayHasKey(Activity::TYPE_FAVORITES, $result); + $this->assertEquals($result[Activity::TYPE_FAVORITES], 'Limit notifications about creation and changes to your favorite files'); $this->assertArrayHasKey(Activity::TYPE_SHARE_DELETED, $result); $this->assertArrayHasKey(Activity::TYPE_SHARE_RESTORED, $result); }