summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-11 14:02:44 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-11 14:02:44 +0100
commit4d24929e05e3cfb43e9826e48199d73bd3304def (patch)
treeab944db51231e05f18479d9cb0fe2f021badddf7
parent27a4c9f625d729956c6fefedb540629b8e1a90e3 (diff)
parent31c9e047a80d849a68e050f69e5b4cffdfca9056 (diff)
downloadnextcloud-server-4d24929e05e3cfb43e9826e48199d73bd3304def.tar.gz
nextcloud-server-4d24929e05e3cfb43e9826e48199d73bd3304def.zip
Merge pull request #22307 from owncloud/remove-notification-on-unshare-and-on-errors
Remove notification on unshare and on errors
-rw-r--r--apps/files_sharing/api/remote.php8
-rw-r--r--apps/files_sharing/api/server2server.php7
-rw-r--r--apps/files_sharing/lib/external/manager.php6
3 files changed, 17 insertions, 4 deletions
diff --git a/apps/files_sharing/api/remote.php b/apps/files_sharing/api/remote.php
index 4b7192994a7..8b47955b51e 100644
--- a/apps/files_sharing/api/remote.php
+++ b/apps/files_sharing/api/remote.php
@@ -67,6 +67,9 @@ class Remote {
return new \OC_OCS_Result();
}
+ // Make sure the user has no notification for something that does not exist anymore.
+ $externalManager->processNotification((int) $params['id']);
+
return new \OC_OCS_Result(null, 404, "wrong share ID, share doesn't exist.");
}
@@ -90,12 +93,15 @@ class Remote {
return new \OC_OCS_Result();
}
+ // Make sure the user has no notification for something that does not exist anymore.
+ $externalManager->processNotification((int) $params['id']);
+
return new \OC_OCS_Result(null, 404, "wrong share ID, share doesn't exist.");
}
/**
* @param array $share Share with info from the share_external table
- * @return enriched share info with data from the filecache
+ * @return array enriched share info with data from the filecache
*/
private static function extendShareInfo($share) {
$view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/');
diff --git a/apps/files_sharing/api/server2server.php b/apps/files_sharing/api/server2server.php
index a27b3a3bd85..f04ddc81b84 100644
--- a/apps/files_sharing/api/server2server.php
+++ b/apps/files_sharing/api/server2server.php
@@ -225,6 +225,13 @@ class Server2Server {
$path = trim($share['name'], '/');
}
+ $notificationManager = \OC::$server->getNotificationManager();
+ $notification = $notificationManager->createNotification();
+ $notification->setApp('files_sharing')
+ ->setUser($share['user'])
+ ->setObject('remote_share', (int) $share['id']);
+ $notificationManager->markProcessed($notification);
+
\OC::$server->getActivityManager()->publishActivity(
Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_UNSHARED, array($owner, $path), '', array(),
'', '', $user, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_MEDIUM);
diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php
index 21729d326e5..84de1da69f6 100644
--- a/apps/files_sharing/lib/external/manager.php
+++ b/apps/files_sharing/lib/external/manager.php
@@ -194,7 +194,7 @@ class Manager {
\OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $share['remote']]);
- $this->scrapNotification($id);
+ $this->processNotification($id);
return true;
}
@@ -217,7 +217,7 @@ class Manager {
$removeShare->execute(array($id, $this->uid));
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline');
- $this->scrapNotification($id);
+ $this->processNotification($id);
return true;
}
@@ -227,7 +227,7 @@ class Manager {
/**
* @param int $remoteShare
*/
- protected function scrapNotification($remoteShare) {
+ public function processNotification($remoteShare) {
$filter = $this->notificationManager->createNotification();
$filter->setApp('files_sharing')
->setUser($this->uid)