Skip to content

Commit

Permalink
feat(Contexts): enable nav bar display logic
Browse files Browse the repository at this point in the history
It was temporarily disabled and shown by default as we did not have web UI
controls to configure it.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed Jul 12, 2024
1 parent 6a22984 commit 65ea493
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions lib/Listener/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
class BeforeTemplateRenderedListener implements IEventListener {
public function __construct(
protected INavigationManager $navigationManager,
protected IURLGenerator $urlGenerator,
protected IUserSession $userSession,
protected ContextService $contextService,
protected IURLGenerator $urlGenerator,
protected IUserSession $userSession,
protected ContextService $contextService,
) {
}

Expand All @@ -36,25 +36,22 @@ public function handle(Event $event): void {
return;
}

// temporarily show all
//$contexts = $this->contextService->findForNavigation($user->getUID());
$contexts = $this->contextService->findAll($user->getUID());
$contexts = $this->contextService->findForNavigation($user->getUID());
foreach ($contexts as $context) {
/* temporarily, show all
if ($context->getOwnerType() === Application::OWNER_TYPE_USER
&& $context->getOwnerId() === $user->getUID()) {

// filter out entries for owners unless it is set to be visible
$skipEntry = true;
foreach ($context->getSharing() as $shareInfo) {
// TODO: integrate into DB query in Mapper
if (isset($shareInfo['display_mode']) && $shareInfo['display_mode'] === Application::NAV_ENTRY_MODE_ALL) {
// a custom override makes it visible
$skipEntry = false;
break;
} elseif (!isset($shareInfo['display_mode']) && $shareInfo['display_mode_default'] === Application::NAV_ENTRY_MODE_ALL) {
}

if (!isset($shareInfo['display_mode']) && $shareInfo['display_mode_default'] === Application::NAV_ENTRY_MODE_ALL) {
// no custom override, and visible also for owner by default
$skipEntry = false;
break;
Expand All @@ -64,7 +61,6 @@ public function handle(Event $event): void {
continue;
}
}
*/

$this->navigationManager->add(function () use ($context) {
$iconRelPath = 'material/' . $context->getIcon() . '.svg';
Expand Down

0 comments on commit 65ea493

Please sign in to comment.