|
|
|
@ -28,6 +28,7 @@ use OCP\Activity\IExtension; |
|
|
|
|
use OCP\IURLGenerator; |
|
|
|
|
|
|
|
|
|
class Activity implements IExtension { |
|
|
|
|
const FILES_SHARING_APP = 'files_sharing'; |
|
|
|
|
/** |
|
|
|
|
* Filter with all sharing related activities |
|
|
|
|
*/ |
|
|
|
@ -72,7 +73,7 @@ class Activity implements IExtension { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function getL10N($languageCode = null) { |
|
|
|
|
return $this->languageFactory->get('files_sharing', $languageCode); |
|
|
|
|
return $this->languageFactory->get(self::FILES_SHARING_APP, $languageCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -146,7 +147,7 @@ class Activity implements IExtension { |
|
|
|
|
public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode) { |
|
|
|
|
$l = $this->getL10N($languageCode); |
|
|
|
|
|
|
|
|
|
if ($app === 'files_sharing') { |
|
|
|
|
if ($app === self::FILES_SHARING_APP) { |
|
|
|
|
switch ($text) { |
|
|
|
|
case self::SUBJECT_REMOTE_SHARE_RECEIVED: |
|
|
|
|
return (string) $l->t('You received a new remote share from %s', $params); |
|
|
|
@ -160,9 +161,6 @@ class Activity implements IExtension { |
|
|
|
|
return (string) $l->t('Public shared folder %1$s was downloaded', $params); |
|
|
|
|
case self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED: |
|
|
|
|
return (string) $l->t('Public shared file %1$s was downloaded', $params); |
|
|
|
|
} |
|
|
|
|
} else if ($app === 'files') { |
|
|
|
|
switch ($text) { |
|
|
|
|
case self::SUBJECT_SHARED_USER_SELF: |
|
|
|
|
return (string) $l->t('You shared %1$s with %2$s', $params); |
|
|
|
|
case self::SUBJECT_SHARED_GROUP_SELF: |
|
|
|
@ -189,7 +187,7 @@ class Activity implements IExtension { |
|
|
|
|
* @return array|false |
|
|
|
|
*/ |
|
|
|
|
public function getSpecialParameterList($app, $text) { |
|
|
|
|
if ($app === 'files_sharing') { |
|
|
|
|
if ($app === self::FILES_SHARING_APP) { |
|
|
|
|
switch ($text) { |
|
|
|
|
case self::SUBJECT_REMOTE_SHARE_RECEIVED: |
|
|
|
|
return array( |
|
|
|
@ -207,9 +205,6 @@ class Activity implements IExtension { |
|
|
|
|
return array( |
|
|
|
|
0 => 'file', |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} else if ($app === 'files') { |
|
|
|
|
switch ($text) { |
|
|
|
|
case self::SUBJECT_SHARED_LINK_SELF: |
|
|
|
|
return [0 => 'file']; |
|
|
|
|
case self::SUBJECT_SHARED_USER_SELF: |
|
|
|
@ -273,7 +268,7 @@ class Activity implements IExtension { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The extension can check if a customer filter (given by a query string like filter=abc) is valid or not. |
|
|
|
|
* The extension can check if a custom filter (given by a query string like filter=abc) is valid or not. |
|
|
|
|
* |
|
|
|
|
* @param string $filterValue |
|
|
|
|
* @return boolean |
|
|
|
@ -310,8 +305,8 @@ class Activity implements IExtension { |
|
|
|
|
public function getQueryForFilter($filter) { |
|
|
|
|
if ($filter === self::FILTER_SHARES) { |
|
|
|
|
return [ |
|
|
|
|
'(`app` = ? or `app` = ?)', |
|
|
|
|
['files_sharing', 'files'], |
|
|
|
|
'`app` = ?', |
|
|
|
|
[self::FILES_SHARING_APP,], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|