Skip to content

Commit

Permalink
Use getRelativePath for relative path in activity listeners
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Jun 27, 2023
1 parent af926ba commit 287a5a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions apps/comments/lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ public function commentEvent(CommentsEvent $event): void {
$users = [];
$filesPerUser = $cache->getReadableNodesByUserForFileId((int)$event->getComment()->getObjectId());
foreach ($filesPerUser as $user => $files) {
/* Remove /user/files prefix */
$sections = explode('/', reset($files)?->getPath() ?? '', 4);
$users[$user] = '/'.($sections[3] ?? '');
$users[$user] = $this->rootFolder->getUserFolder($user)->getRelativePath(reset($files)?->getPath() ?? '');
}

$actor = $this->session->getUser();
Expand Down
4 changes: 1 addition & 3 deletions apps/systemtags/lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ public function mapperEvent(MapperEvent $event) {
return;
}
foreach ($filesPerUser as $user => $files) {
/* Remove /user/files prefix */
$sections = explode('/', reset($files)?->getPath() ?? '', 4);
$users[$user] = '/'.($sections[3] ?? '');
$users[$user] = $this->rootFolder->getUserFolder($user)->getRelativePath(reset($files)?->getPath() ?? '');
}

$actor = $this->session->getUser();
Expand Down

0 comments on commit 287a5a8

Please sign in to comment.