Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable26] groupfolder activities on move/rename #1204

Merged
merged 1 commit into from Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 22 additions & 1 deletion lib/FilesHooks.php
Expand Up @@ -354,7 +354,16 @@ public function fileMove($oldPath, $newPath) {
$this->moveCase = false;
return;
}
$this->oldAccessList = $this->getUserPathsFromPath($this->oldParentPath, $this->oldParentOwner);

$oldAccessList = $this->getUserPathsFromPath($this->oldParentPath, $this->oldParentOwner);

// file can be shared using GroupFolders, including ACL check
if ($this->config->getSystemValueBool('activity_use_cached_mountpoints', false)) {
[, , $oldFileId] = $this->getSourcePathAndOwner($oldPath);
$oldAccessList['users'] = array_merge($oldAccessList['users'], $this->getAffectedUsersFromCachedMounts($oldFileId));
}

$this->oldAccessList = $oldAccessList;
}


Expand Down Expand Up @@ -415,6 +424,12 @@ protected function fileRenaming($oldPath, $newPath) {
$this->generateRemoteActivity($renameRemotes, Files::TYPE_FILE_CHANGED, time(), $this->currentUser->getCloudId());

$affectedUsers = $accessList['users'];

// file can be shared using GroupFolders, including ACL check
if ($this->config->getSystemValueBool('activity_use_cached_mountpoints', false)) {
$affectedUsers = array_merge($affectedUsers, $this->getAffectedUsersFromCachedMounts($fileId));
}

[$filteredEmailUsers, $filteredNotificationUsers] = $this->getFileChangeActivitySettings($fileId, array_keys($affectedUsers));

foreach ($affectedUsers as $user => $path) {
Expand Down Expand Up @@ -464,6 +479,12 @@ protected function fileMoving($oldPath, $newPath) {
$affectedUsers = $accessList['users'];
$oldUsers = $this->oldAccessList['users'];

// file can be shared using GroupFolders, including ACL check
if ($this->config->getSystemValueBool('activity_use_cached_mountpoints', false)) {
$this->userMountCache->clear(); // clear cache for new data
$affectedUsers = array_merge($affectedUsers, $this->getAffectedUsersFromCachedMounts($fileId));
}

$beforeUsers = array_keys($oldUsers);
$afterUsers = array_keys($affectedUsers);

Expand Down