Skip to content

Commit d7f95d8

Browse files
Merge pull request #1163 from nextcloud/enh/noid/gf-activity-on-move
groupfolder activities on move/rename
2 parents f19219d + 853772f commit d7f95d8

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

lib/FilesHooks.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,16 @@ public function fileMove($oldPath, $newPath) {
353353
$this->moveCase = false;
354354
return;
355355
}
356-
$this->oldAccessList = $this->getUserPathsFromPath($this->oldParentPath, $this->oldParentOwner);
356+
357+
$oldAccessList = $this->getUserPathsFromPath($this->oldParentPath, $this->oldParentOwner);
358+
359+
// file can be shared using GroupFolders, including ACL check
360+
if ($this->config->getSystemValueBool('activity_use_cached_mountpoints', false)) {
361+
[, , $oldFileId] = $this->getSourcePathAndOwner($oldPath);
362+
$oldAccessList['users'] = array_merge($oldAccessList['users'], $this->getAffectedUsersFromCachedMounts($oldFileId));
363+
}
364+
365+
$this->oldAccessList = $oldAccessList;
357366
}
358367

359368

@@ -414,6 +423,12 @@ protected function fileRenaming($oldPath, $newPath) {
414423
$this->generateRemoteActivity($renameRemotes, Files::TYPE_FILE_CHANGED, time(), $this->currentUser->getCloudId());
415424

416425
$affectedUsers = $accessList['users'];
426+
427+
// file can be shared using GroupFolders, including ACL check
428+
if ($this->config->getSystemValueBool('activity_use_cached_mountpoints', false)) {
429+
$affectedUsers = array_merge($affectedUsers, $this->getAffectedUsersFromCachedMounts($fileId));
430+
}
431+
417432
[$filteredEmailUsers, $filteredNotificationUsers] = $this->getFileChangeActivitySettings($fileId, array_keys($affectedUsers));
418433

419434
foreach ($affectedUsers as $user => $path) {
@@ -463,6 +478,12 @@ protected function fileMoving($oldPath, $newPath) {
463478
$affectedUsers = $accessList['users'];
464479
$oldUsers = $this->oldAccessList['users'];
465480

481+
// file can be shared using GroupFolders, including ACL check
482+
if ($this->config->getSystemValueBool('activity_use_cached_mountpoints', false)) {
483+
$this->userMountCache->clear(); // clear cache for new data
484+
$affectedUsers = array_merge($affectedUsers, $this->getAffectedUsersFromCachedMounts($fileId));
485+
}
486+
466487
$beforeUsers = array_keys($oldUsers);
467488
$afterUsers = array_keys($affectedUsers);
468489

0 commit comments

Comments
 (0)