summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/External/Manager.php
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-07-21 12:07:32 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2017-07-21 12:07:32 +0200
commite78040d2502aba01b5dd92497078ac71afab771a (patch)
tree88b733e37fa5ad8b45ee21766996f3d8ae4baf0c /apps/files_sharing/lib/External/Manager.php
parent5e468c0bbaf6b9838a1b92bcb04836dccff7b532 (diff)
downloadnextcloud-server-e78040d2502aba01b5dd92497078ac71afab771a.tar.gz
nextcloud-server-e78040d2502aba01b5dd92497078ac71afab771a.zip
improved error handling
check if table was updated successfully and only then send a notification mail and return "true". Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/files_sharing/lib/External/Manager.php')
-rw-r--r--apps/files_sharing/lib/External/Manager.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php
index 54d0f9bd0c3..fe4fe492a2b 100644
--- a/apps/files_sharing/lib/External/Manager.php
+++ b/apps/files_sharing/lib/External/Manager.php
@@ -197,6 +197,7 @@ class Manager {
public function acceptShare($id) {
$share = $this->getShare($id);
+ $result = false;
if ($share) {
\OC_Util::setupFS($this->uid);
@@ -211,16 +212,18 @@ class Manager {
`mountpoint` = ?,
`mountpoint_hash` = ?
WHERE `id` = ? AND `user` = ?');
- $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid));
- $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');
-
- \OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $share['remote']]);
-
- $this->processNotification($id);
- return true;
+ $updated = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid));
+ if ($updated === true) {
+ $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');
+ \OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $share['remote']]);
+ $result = true;
+ }
}
- return false;
+ // Make sure the user has no notification for something that does not exist anymore.
+ $this->processNotification($id);
+
+ return $result;
}
/**