From 96a45f043397f063432fa45db21b894133936573 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 15 Apr 2024 12:29:22 +0200 Subject: [PATCH] fix(Contexts): fetch share information also as sender, not only recipient Signed-off-by: Arthur Schiwon --- lib/Db/ContextMapper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Db/ContextMapper.php b/lib/Db/ContextMapper.php index 91b6ae44a..afda9ee0d 100644 --- a/lib/Db/ContextMapper.php +++ b/lib/Db/ContextMapper.php @@ -219,6 +219,10 @@ public function findById(int $contextId, ?string $userId = null): Context { protected function applyOwnedOrSharedQuery(IQueryBuilder $qb, string $userId): void { $sharedToConditions = $qb->expr()->orX(); + // shared by user clause + $userInitiatedShare = $qb->expr()->eq('s.sender', $qb->createNamedParameter($userId)); + $sharedToConditions->add($userInitiatedShare); + // shared to user clause $userShare = $qb->expr()->andX( $qb->expr()->eq('s.receiver_type', $qb->createNamedParameter('user')),