Skip to content

Commit bb667f4

Browse files
committed
fixup! feat(conversationfolder): use per share conversation folders
1 parent cf9e385 commit bb667f4

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

lib/Chat/Parser/SystemMessage.php

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -816,19 +816,34 @@ protected function parseDeletedMessage(Message $chatMessage): void {
816816
*/
817817
protected function getFileFromNodeId(Room $room, ?Participant $participant, int $nodeId, bool $allowInaccurate = false): array {
818818
if ($participant && $participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
819-
$uid = $participant->getAttendee()->getActorId();
820-
$userFolder = $this->rootFolder->getUserFolder($uid);
819+
if ($allowInaccurate) {
820+
// Lightweight lookup: search the filecache directly without setting up the user
821+
// filesystem, mirroring getFileFromShare()'s use of getNodeCacheEntry().
822+
// Path is intentionally inaccurate (filename only) — callers that need the full
823+
// relative path must pass $allowInaccurate = false.
824+
$node = $this->rootFolder->getFirstNodeById($nodeId);
825+
if (!$node instanceof Node) {
826+
throw new NotFoundException('File node ' . $nodeId . ' not found');
827+
}
821828

822-
$node = $userFolder->getFirstNodeById($nodeId);
823-
if (!$node instanceof Node) {
824-
throw new NotFoundException('File node ' . $nodeId . ' not found for user ' . $uid);
825-
}
829+
$name = $node->getName();
830+
$size = $node->getSize();
831+
$path = $name;
832+
} else {
833+
$uid = $participant->getAttendee()->getActorId();
834+
$userFolder = $this->rootFolder->getUserFolder($uid);
826835

827-
$fullPath = $node->getPath();
828-
$pathSegments = explode('/', $fullPath, 4);
829-
$name = $node->getName();
830-
$size = $node->getSize();
831-
$path = $pathSegments[3] ?? $name;
836+
$node = $userFolder->getFirstNodeById($nodeId);
837+
if (!$node instanceof Node) {
838+
throw new NotFoundException('File node ' . $nodeId . ' not found for user ' . $uid);
839+
}
840+
841+
$fullPath = $node->getPath();
842+
$pathSegments = explode('/', $fullPath, 4);
843+
$name = $node->getName();
844+
$size = $node->getSize();
845+
$path = $pathSegments[3] ?? $name;
846+
}
832847

833848
$url = $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', [
834849
'fileid' => $node->getId(),

0 commit comments

Comments
 (0)