]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix activity emails for accept/decline of remote shares
authorJoas Schilling <coding@schilljs.com>
Mon, 10 Jul 2017 10:10:36 +0000 (12:10 +0200)
committerJoas Schilling <coding@schilljs.com>
Mon, 10 Jul 2017 10:28:32 +0000 (12:28 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
apps/files_sharing/lib/Activity/Providers/RemoteShares.php

index 8a7a1188c288c0dc2c71cb4f810d9ee4f48c51c1..09704047c7b0375fbe660564e9c62b4810189445 100644 (file)
@@ -318,14 +318,15 @@ class RequestHandlerController extends OCSController {
        }
 
        protected function executeAcceptShare(Share\IShare $share) {
-               list($file, $link) = $this->getFile($this->getCorrectUid($share), $share->getNode()->getId());
+               $fileId = (int) $share->getNode()->getId();
+               list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
 
                $event = \OC::$server->getActivityManager()->generateEvent();
                $event->setApp('files_sharing')
                        ->setType('remote_share')
                        ->setAffectedUser($this->getCorrectUid($share))
-                       ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share->getSharedWith(), $file])
-                       ->setObject('files', (int)$share->getNode()->getId(), $file)
+                       ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share->getSharedWith(), [$fileId => $file]])
+                       ->setObject('files', $fileId, $file)
                        ->setLink($link);
                \OC::$server->getActivityManager()->publish($event);
        }
@@ -373,14 +374,15 @@ class RequestHandlerController extends OCSController {
         */
        protected function executeDeclineShare(Share\IShare $share) {
                $this->federatedShareProvider->removeShareFromTable($share);
-               list($file, $link) = $this->getFile($this->getCorrectUid($share), $share->getNode()->getId());
+               $fileId = (int) $share->getNode()->getId();
+               list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
 
                $event = \OC::$server->getActivityManager()->generateEvent();
                $event->setApp('files_sharing')
                        ->setType('remote_share')
                        ->setAffectedUser($this->getCorrectUid($share))
-                       ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_DECLINED, [$share->getSharedWith(), $file])
-                       ->setObject('files', (int)$share->getNode()->getId(), $file)
+                       ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_DECLINED, [$share->getSharedWith(), [$fileId => $file]])
+                       ->setObject('files', $fileId, $file)
                        ->setLink($link);
                \OC::$server->getActivityManager()->publish($event);
 
index 6ac0be76ff40af6c45cbfd0b4dac884e8e2ee09d..cf4954800e862db0aaa8c56e332cf9c60a4eaba1 100644 (file)
@@ -131,8 +131,12 @@ class RemoteShares extends Base {
                                ];
                        case self::SUBJECT_REMOTE_SHARE_ACCEPTED:
                        case self::SUBJECT_REMOTE_SHARE_DECLINED:
+                               $fileParameter = $parameters[1];
+                               if (!is_array($fileParameter)) {
+                                       $fileParameter = [$event->getObjectId() => $event->getObjectName()];
+                               }
                                return [
-                                       'file' => $this->getFile([$event->getObjectId() => $event->getObjectName()]),
+                                       'file' => $this->getFile($fileParameter),
                                        'user' => $this->getFederatedUser($parameters[0]),
                                ];
                }