diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-07-10 16:16:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 16:16:54 +0200 |
commit | 22693aec4764709ec731eda90fe7414e4cde8439 (patch) | |
tree | 4d71bca476528a875a06fed6ee1859bd1d1e845b /apps | |
parent | a15591347ad53ef9333c2635fa23b8617ebe9f01 (diff) | |
parent | 33cb45d4a3bcb7b78b587f1c733b072967694627 (diff) | |
download | nextcloud-server-22693aec4764709ec731eda90fe7414e4cde8439.tar.gz nextcloud-server-22693aec4764709ec731eda90fe7414e4cde8439.zip |
Merge pull request #5669 from nextcloud/fix-remote-share-activity-emails
Fix remote share activity emails
Diffstat (limited to 'apps')
-rw-r--r-- | apps/federatedfilesharing/lib/Controller/RequestHandlerController.php | 16 | ||||
-rw-r--r-- | apps/files_sharing/lib/Activity/Providers/RemoteShares.php | 6 |
2 files changed, 14 insertions, 8 deletions
diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index 8a7a1188c28..4f64e6147e1 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -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); @@ -449,7 +451,7 @@ class RequestHandlerController extends OCSController { $event = \OC::$server->getActivityManager()->generateEvent(); $event->setApp('files_sharing') ->setType('remote_share') - ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner, $path]) + ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) ->setAffectedUser($user) ->setObject('remote_share', (int)$share['id'], $path); \OC::$server->getActivityManager()->publish($event); diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index 6ac0be76ff4..cf4954800e8 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -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]), ]; } |