Skip to content

Commit

Permalink
Only use the visible path
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Mar 10, 2020
1 parent f6ba25b commit 9bdda0a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/FilesHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ protected function addNotificationsForFileAction($filePath, $activityType, $subj
return $mount->getUser()->getUID();
}, $mountsForFile);
$affectedPaths = array_map(function (ICachedMountFileInfo $mount) {
return $mount->getPath();
return $this->getVisiblePath($mount->getPath());
}, $mountsForFile);
$affectedUsers = array_combine($affectedUserIds, $affectedPaths);
$filteredStreamUsers = $this->userSettings->filterUsersBySetting(array_keys($affectedUsers), 'stream', $activityType);
Expand Down Expand Up @@ -631,15 +631,20 @@ protected function getUserPathsFromPath($path, $uidOwner) {
$accessList = $this->shareHelper->getPathsForAccessList($node);

$path = $node->getPath();
$sections = explode('/', $path, 4);
$accessList['ownerPath'] = $this->getVisiblePath($path);
return $accessList;
}

$accessList['ownerPath'] = '/';
protected function getVisiblePath(string $absolutePath): string {
$sections = explode('/', $absolutePath, 4);

$path = '/';
if (isset($sections[3])) {
// Not the case when a file in root is renamed
$accessList['ownerPath'] .= $sections[3];
$path .= $sections[3];
}

return $accessList;
return $path;
}

/**
Expand Down

0 comments on commit 9bdda0a

Please sign in to comment.