handle unshare request from owner

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-06-29 18:02:12 +02:00
parent 7d2add622e
commit 1d5a9c3f97
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 25 additions and 18 deletions

View File

@ -578,25 +578,32 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
$qb->execute();
if ($share['accepted']) {
$path = trim($mountpoint, '/');
} else {
$path = trim($share['name'], '/');
// delete all child in case of a group share
$qb = $this->connection->getQueryBuilder();
$qb->delete('share_external')
->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id'])));
$qb->execute();
if ((int)$share['share_type'] === Share::SHARE_TYPE_USER) {
if ($share['accepted']) {
$path = trim($mountpoint, '/');
} else {
$path = trim($share['name'], '/');
}
$notification = $this->notificationManager->createNotification();
$notification->setApp('files_sharing')
->setUser($share['user'])
->setObject('remote_share', (int)$share['id']);
$this->notificationManager->markProcessed($notification);
$event = $this->activityManager->generateEvent();
$event->setApp('files_sharing')
->setType('remote_share')
->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path])
->setAffectedUser($user)
->setObject('remote_share', (int)$share['id'], $path);
\OC::$server->getActivityManager()->publish($event);
}
$notification = $this->notificationManager->createNotification();
$notification->setApp('files_sharing')
->setUser($share['user'])
->setObject('remote_share', (int)$share['id']);
$this->notificationManager->markProcessed($notification);
$event = $this->activityManager->generateEvent();
$event->setApp('files_sharing')
->setType('remote_share')
->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path])
->setAffectedUser($user)
->setObject('remote_share', (int)$share['id'], $path);
\OC::$server->getActivityManager()->publish($event);
}
return [];