diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-15 19:36:43 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-15 19:36:43 +0100 |
commit | 0667c4363d2777b3534e72afe536eb9a9aa0ef3e (patch) | |
tree | c6d60bfea748404f01d0208d9ac08680fbbede06 /apps/files_sharing/api/server2server.php | |
parent | 6379b1932ff6440865f765a918ff097849ed785f (diff) | |
parent | 230029e5090b3deecb941e75bbc34a6bcb98c374 (diff) | |
download | nextcloud-server-0667c4363d2777b3534e72afe536eb9a9aa0ef3e.tar.gz nextcloud-server-0667c4363d2777b3534e72afe536eb9a9aa0ef3e.zip |
Merge branch 'master' into smb-workgroup
Diffstat (limited to 'apps/files_sharing/api/server2server.php')
-rw-r--r-- | apps/files_sharing/api/server2server.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files_sharing/api/server2server.php b/apps/files_sharing/api/server2server.php index 4328e3830ba..6ecaea20535 100644 --- a/apps/files_sharing/api/server2server.php +++ b/apps/files_sharing/api/server2server.php @@ -70,6 +70,7 @@ class Server2Server { \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), \OC::$server->getHTTPHelper(), + \OC::$server->getNotificationManager(), $shareWith ); @@ -82,6 +83,28 @@ class Server2Server { Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user, trim($name, '/')), '', array(), '', '', $shareWith, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_LOW); + $urlGenerator = \OC::$server->getURLGenerator(); + + $notificationManager = \OC::$server->getNotificationManager(); + $notification = $notificationManager->createNotification(); + $notification->setApp('files_sharing') + ->setUser($shareWith) + ->setTimestamp(time()) + ->setObject('remote_share', $remoteId) + ->setSubject('remote_share', [$user, trim($name, '/')]); + + $acceptAction = $notification->createAction(); + $acceptAction->setLabel('accept') + ->setLink($urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/remote_shares/' . $remoteId), 'POST'); + $declineAction = $notification->createAction(); + $declineAction->setLabel('decline') + ->setLink($urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/remote_shares/' . $remoteId), 'DELETE'); + + $notification->addAction($acceptAction) + ->addAction($declineAction); + + $notificationManager->notify($notification); + return new \OC_OCS_Result(); } catch (\Exception $e) { \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR); |