]> source.dussan.org Git - nextcloud-server.git/commitdiff
Specify list of activity parameters for sharing extension
authorJoas Schilling <nickvergessen@gmx.de>
Thu, 11 Dec 2014 13:55:20 +0000 (14:55 +0100)
committerJoas Schilling <nickvergessen@gmx.de>
Fri, 12 Dec 2014 10:41:01 +0000 (11:41 +0100)
apps/files_sharing/lib/activity.php

index 0f7e8ab9b6384dcebb0c622300c1f383c097044d..979df1c1da665ce746745c80af8428c9043ada6d 100644 (file)
@@ -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 <strong>%2$s</strong>', $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 <strong>%2$s</strong>', $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 <strong>%2$s</strong>', $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.