Skip to content

Commit

Permalink
feat(Contexts): consider group shares when determining nav display
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Dec 17, 2024
1 parent 69918a5 commit 447e4a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Db/ContextMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public function findAll(?string $userId = null): array {
}
public function findForNavBar(string $userId): array {
$qb = $this->getFindContextBaseQuery($userId);
$groupIDs = $this->userHelper->getGroupIdsForUser($userId);
$qb->andWhere($qb->expr()->orX(
// default
$qb->expr()->andX(
Expand All @@ -183,6 +184,11 @@ public function findForNavBar(string $userId): array {
$qb->expr()->neq('c.owner_id', $qb->createNamedParameter($userId)),
$qb->expr()->gt('n.display_mode', $qb->createNamedParameter(Application::NAV_ENTRY_MODE_HIDDEN, IQueryBuilder::PARAM_INT)),
),
$qb->expr()->andX(
$qb->expr()->eq('s.receiver_type', $qb->createNamedParameter('group')),
$qb->expr()->in('s.receiver', $qb->createNamedParameter($groupIDs, IQueryBuilder::PARAM_STR_ARRAY)),
$qb->expr()->gt('n.display_mode', $qb->createNamedParameter(Application::NAV_ENTRY_MODE_HIDDEN, IQueryBuilder::PARAM_INT)),
)
),
),
// user override
Expand Down

0 comments on commit 447e4a7

Please sign in to comment.