Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
b768a706
Commit
b768a706
authored
10 years ago
by
Joas Schilling
Browse files
Options
Downloads
Patches
Plain Diff
Use filterNotificationTypes to filter the types and group the methods
parent
9ccfbc14
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_sharing/lib/activity.php
+37
-43
37 additions, 43 deletions
apps/files_sharing/lib/activity.php
with
37 additions
and
43 deletions
apps/files_sharing/lib/activity.php
+
37
−
43
View file @
b768a706
...
...
@@ -83,22 +83,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.
...
...
@@ -119,6 +103,25 @@ class Activity implements IExtension {
return
$defaultTypes
;
}
/**
* 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.
...
...
@@ -214,25 +217,6 @@ class Activity implements IExtension {
return
false
;
}
/**
* 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.
...
...
@@ -275,6 +259,22 @@ class Activity implements IExtension {
return
$filterValue
===
self
::
FILTER_SHARES
;
}
/**
* 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.
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment