diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-02-13 11:30:36 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-02-13 11:30:36 +0100 |
commit | b768a70616eade852fb1eec43dc3fa5095bf4bf7 (patch) | |
tree | dbaa3a439fb14dff08ca92031602ea4c3a5bbeb0 /apps/files_sharing/lib | |
parent | 9ccfbc14f68959d96b6a88bfa59f600183f4abf1 (diff) | |
download | nextcloud-server-b768a70616eade852fb1eec43dc3fa5095bf4bf7.tar.gz nextcloud-server-b768a70616eade852fb1eec43dc3fa5095bf4bf7.zip |
Use filterNotificationTypes to filter the types and group the methods
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/activity.php | 80 |
1 files changed, 37 insertions, 43 deletions
diff --git a/apps/files_sharing/lib/activity.php b/apps/files_sharing/lib/activity.php index be1bf4b670f..0cd874d69f0 100644 --- a/apps/files_sharing/lib/activity.php +++ b/apps/files_sharing/lib/activity.php @@ -84,22 +84,6 @@ class Activity implements IExtension { } /** - * The extension can filter the types based on the filter if required. - * In case no filter is to be applied false is to be returned unchanged. - * - * @param array $types - * @param string $filter - * @return array|false - */ - public function filterNotificationTypes($types, $filter) { - switch ($filter) { - case self::FILTER_SHARES: - return array_intersect([self::TYPE_SHARED], $types); - } - return false; - } - - /** * For a given method additional types to be displayed in the settings can be returned. * In case no additional types are to be added false is to be returned. * @@ -120,6 +104,25 @@ class Activity implements IExtension { } /** + * A string naming the css class for the icon to be used can be returned. + * If no icon is known for the given type false is to be returned. + * + * @param string $type + * @return string|false + */ + public function getTypeIcon($type) { + switch ($type) { + case self::TYPE_SHARED: + case self::TYPE_REMOTE_SHARE: + return 'icon-share'; + case self::TYPE_PUBLIC_LINKS: + return 'icon-download'; + } + + return false; + } + + /** * The extension can translate a given message to the requested languages. * If no translation is available false is to be returned. * @@ -215,25 +218,6 @@ class Activity implements IExtension { } /** - * A string naming the css class for the icon to be used can be returned. - * If no icon is known for the given type false is to be returned. - * - * @param string $type - * @return string|false - */ - public function getTypeIcon($type) { - switch ($type) { - case self::TYPE_SHARED: - case self::TYPE_REMOTE_SHARE: - return 'icon-share'; - case self::TYPE_PUBLIC_LINKS: - return 'icon-download'; - } - - return false; - } - - /** * The extension can define the parameter grouping by returning the index as integer. * In case no grouping is required false is to be returned. * @@ -276,6 +260,22 @@ class Activity implements IExtension { } /** + * The extension can filter the types based on the filter if required. + * In case no filter is to be applied false is to be returned unchanged. + * + * @param array $types + * @param string $filter + * @return array|false + */ + public function filterNotificationTypes($types, $filter) { + switch ($filter) { + case self::FILTER_SHARES: + return array_intersect([self::TYPE_SHARED, self::TYPE_REMOTE_SHARE], $types); + } + return false; + } + + /** * For a given filter the extension can specify the sql query conditions including parameters for that query. * In case the extension does not know the filter false is to be returned. * The query condition and the parameters are to be returned as array with two elements. @@ -287,14 +287,8 @@ class Activity implements IExtension { public function getQueryForFilter($filter) { if ($filter === self::FILTER_SHARES) { return [ - '(' - . '`app` = ? and `type` = ? or ' - . '`app` = ? and `type` = ?' - . ')', - [ - 'files_sharing', self::TYPE_REMOTE_SHARE, - 'files', self::TYPE_SHARED, - ], + '(`app` = ? or `app` = ?)', + ['files_sharing', 'files'], ]; } return false; |