From 46def69574e15b4ec3230c7e6131b882397e210c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 11 Dec 2014 14:55:20 +0100 Subject: [PATCH] Specify list of activity parameters for sharing extension --- apps/files_sharing/lib/activity.php | 37 ++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/lib/activity.php b/apps/files_sharing/lib/activity.php index 0f7e8ab9b63..979df1c1da6 100644 --- a/apps/files_sharing/lib/activity.php +++ b/apps/files_sharing/lib/activity.php @@ -94,15 +94,46 @@ class Activity implements \OCP\Activity\IExtension { case self::SUBJECT_REMOTE_SHARE_RECEIVED: return $l->t('You received a new remote share from %s', $params)->__toString(); case self::SUBJECT_REMOTE_SHARE_ACCEPTED: - return $l->t('%1$s accepted remote share %2$s', $params)->__toString(); + return $l->t('%1$s accepted remote share %2$s', $params)->__toString(); case self::SUBJECT_REMOTE_SHARE_DECLINED: - return $l->t('%1$s declined remote share %2$s', $params)->__toString(); + return $l->t('%1$s declined remote share %2$s', $params)->__toString(); case self::SUBJECT_REMOTE_SHARE_UNSHARED: - return $l->t('%1$s unshared %2$s', $params)->__toString(); + return $l->t('%1$s unshared %2$s', $params)->__toString(); } } } + /** + * The extension can define the type of parameters for translation + * + * Currently known types are: + * * file => will strip away the path of the file and add a tooltip with it + * * username => will add the avatar of the user + * + * @param string $app + * @param string $text + * @return array|false + */ + public function getSpecialParameterList($app, $text) { + if ($app === 'files_sharing') { + switch ($text) { + case self::SUBJECT_REMOTE_SHARE_RECEIVED: + return array( + 0 => '',// We can not use 'username' since the user is in a different ownCloud + ); + case self::SUBJECT_REMOTE_SHARE_ACCEPTED: + case self::SUBJECT_REMOTE_SHARE_DECLINED: + case self::SUBJECT_REMOTE_SHARE_UNSHARED: + return array( + 0 => '',// We can not use 'username' since the user is in a different ownCloud + 1 => 'file', + ); + } + } + + 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. -- 2.39.5