From: Joas Schilling Date: Thu, 11 Dec 2014 13:55:20 +0000 (+0100) Subject: Specify list of activity parameters for sharing extension X-Git-Tag: v8.0.0alpha1~100^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=46def69574e15b4ec3230c7e6131b882397e210c;p=nextcloud-server.git Specify list of activity parameters for sharing extension --- 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.