Skip to content

Commit a18fb52

Browse files
authored
Merge pull request #1208 from nextcloud/backport/1163/stable23
[stable23] groupfolder activities on move/rename
2 parents 1d9925b + 017f276 commit a18fb52

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
@@ -355,7 +355,16 @@ public function fileMove($oldPath, $newPath) {
355355
$this->moveCase = false;
356356
return;
357357
}
358-
$this->oldAccessList = $this->getUserPathsFromPath($this->oldParentPath, $this->oldParentOwner);
358+
359+
$oldAccessList = $this->getUserPathsFromPath($this->oldParentPath, $this->oldParentOwner);
360+
361+
// file can be shared using GroupFolders, including ACL check
362+
if ($this->config->getSystemValueBool('activity_use_cached_mountpoints', false)) {
363+
[, , $oldFileId] = $this->getSourcePathAndOwner($oldPath);
364+
$oldAccessList['users'] = array_merge($oldAccessList['users'], $this->getAffectedUsersFromCachedMounts($oldFileId));
365+
}
366+
367+
$this->oldAccessList = $oldAccessList;
359368
}
360369

361370

@@ -416,6 +425,12 @@ protected function fileRenaming($oldPath, $newPath) {
416425
$this->generateRemoteActivity($renameRemotes, Files::TYPE_FILE_CHANGED, time(), $this->currentUser->getCloudId());
417426

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

421436
foreach ($affectedUsers as $user => $path) {
@@ -465,6 +480,12 @@ protected function fileMoving($oldPath, $newPath) {
465480
$affectedUsers = $accessList['users'];
466481
$oldUsers = $this->oldAccessList['users'];
467482

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

0 commit comments

Comments
 (0)