fix notification when a group share is received

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-06-29 11:30:48 +02:00
parent 4c00c80a83
commit 7a48a85dca
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 15 additions and 9 deletions

View File

@ -235,6 +235,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
$externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId);
$shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external');
if ($shareType === Share::SHARE_TYPE_USER) {
$event = $this->activityManager->generateEvent();
$event->setApp('files_sharing')
->setType('remote_share')
@ -242,13 +243,18 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
->setAffectedUser($shareWith)
->setObject('remote_share', (int)$shareId, $name);
\OC::$server->getActivityManager()->publish($event);
if ($shareType === Share::SHARE_TYPE_USER) {
$this->notifyAboutNewShare($shareWith, $shareId, $ownerFederatedId, $sharedByFederatedId, $name);
} else {
$groupMembers = $this->groupManager->get($shareWith)->getUsers();
foreach ($groupMembers as $user) {
$this->notifyAboutNewShare($user, $shareId, $ownerFederatedId, $sharedByFederatedId, $name);
$event = $this->activityManager->generateEvent();
$event->setApp('files_sharing')
->setType('remote_share')
->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')])
->setAffectedUser($user->getUID())
->setObject('remote_share', (int)$shareId, $name);
\OC::$server->getActivityManager()->publish($event);
$this->notifyAboutNewShare($user->getUID(), $shareId, $ownerFederatedId, $sharedByFederatedId, $name);
}
}
return $shareId;