]> source.dussan.org Git - nextcloud-server.git/commitdiff
Specify the parameters on public download 2262/head
authorJoas Schilling <coding@schilljs.com>
Tue, 22 Nov 2016 19:14:42 +0000 (20:14 +0100)
committerJoas Schilling <coding@schilljs.com>
Tue, 22 Nov 2016 19:14:42 +0000 (20:14 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/files_sharing/lib/Activity/Providers/Downloads.php

index 84ef5895dde7fd0feb9eacedc3b9c123012e66a2..39e2a846b3070bfe7352d0898445f781aee0cf5d 100644 (file)
@@ -87,7 +87,7 @@ class Downloads implements IProvider {
        public function parseShortVersion(IEvent $event) {
                $parsedParameters = $this->getParsedParameters($event);
 
-               if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED ||
+               if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED ||
                        $event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED) {
                        $event->setParsedSubject($this->l->t('Downloaded via public link'))
                                ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.svg')));
@@ -114,7 +114,7 @@ class Downloads implements IProvider {
        public function parseLongVersion(IEvent $event) {
                $parsedParameters = $this->getParsedParameters($event);
 
-               if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED ||
+               if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED ||
                        $event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED) {
                        $event->setParsedSubject($this->l->t('%1$s downloaded via public link', [
                                        $parsedParameters['file']['path'],
@@ -150,6 +150,11 @@ class Downloads implements IProvider {
                $parameters = $event->getSubjectParameters();
 
                switch ($subject) {
+                       case self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED:
+                       case self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED:
+                               return [
+                                       'file' => $this->generateFileParameter($event->getObjectId(), $parameters[0]),
+                               ];
                        case self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED:
                        case self::SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED:
                                return [
@@ -161,7 +166,8 @@ class Downloads implements IProvider {
                                        ],
                                ];
                }
-               return [];
+
+               throw new \InvalidArgumentException();
        }
 
        /**