Skip to content

Let bundles contribute entries to the profile menu - #4018

Merged
markus-moser merged 11 commits into
2026.xfrom
feat/user-menu-slot
Aug 24, 2026
Merged

Let bundles contribute entries to the profile menu#4018
markus-moser merged 11 commits into
2026.xfrom
feat/user-menu-slot

Conversation

@markus-moser

@markus-moser markus-moser commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Adds a user-menu context-menu slot so bundles can contribute an entry to it, and moves the built-in rows onto the same slot.

The user menu hardcoded its four items and had no extension point. ContextMenuRegistry already models this — providers, priority, null to hide — and both surfaces are antd Dropdowns fed ItemType[], so no new machinery is needed. First use of that registry on app chrome rather than on an element.

  • contextMenuConfig.userMenu, slot name user-menu
  • Notifications (100), My profile (200) and Log out (9999) become providers; a bundle can position against them or hide one via overrideSlotProvider
  • The username header stays hardcoded — it's a header, not an entry
  • Slot item icons get the built-ins' .user-menu__item-icon wrapper

Two things worth knowing:

  • Logout is 9999 because getSlotProviders defaults a missing priority to 999 — anything lower loses last place to a provider that omits one.
  • The send-notification modal moved to useModalHolder, which is what lets the notifications row leave UserMenu.

Providers must register at module init: useContextMenuSlot calls each useMenuItem() in a map, so a late registration shifts hook order.

No test — base-layout has no component-test setup. Happy to add the harness if wanted.

Consumer PR: pimcore/collab-bundle#89

markus-moser and others added 8 commits August 24, 2026 13:31
The profile dropdown had no extension point, so a bundle wanting a personal,
user-scoped entry could only fall back to the left-sidebar component slot.

Adds a `user-menu` context-menu slot: providers render between "My profile" and
"Log out", and their icons get the same wrapper as the built-in entries so third-
party rows line up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Notifications, My profile and Log out become providers like any third-party
entry, so a bundle can position itself against them, reorder them, or hide one
via overrideSlotProvider — an SSO-only or kiosk deployment has a reason to drop
Log out.

Logout sits at 9999 rather than a merely large number: the registry defaults a
missing priority to 999, so anything lower loses its last place to a provider
that omits one.

The send-notification modal moves to the modal holder, which is what lets the
notifications row leave UserMenu at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@markus-moser markus-moser added this to the 2026.3.0 milestone Aug 24, 2026
@markus-moser
markus-moser marked this pull request as ready for review August 24, 2026 13:15
Copilot AI balanced review requested due to automatic review settings August 24, 2026 13:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Verdict: Needs changes

Adds an extensible user-menu context-menu slot and migrates built-in entries to module-owned providers.

Changes:

  • Registers notifications, profile, and logout providers.
  • Uses the registry to compose the user menu.
  • Moves notification widget configurations to avoid circular imports.

Assessment:

  • Fixes the root cause at the correct boundary (user-menu.tsx:51-71).
  • Existing exports and call sites remain covered; no breaking API change found.
  • Provider priorities duplicate the exported configuration.
  • Public slot documentation is not updated.
  • No focused tests were added; comparable menu-provider seams currently lack tests.
  • Runtime registration remains risky because provider changes can alter hook order.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
notifications/widget-configs.ts Extracts notification widget definitions.
notifications/user-menu-item.tsx Adds the notifications menu provider.
notifications/index.tsx Registers and re-exports notification functionality.
auth/profile/user-menu-item.tsx Adds the profile provider.
auth/logout-user-menu-item.tsx Adds the logout provider.
auth/index.ts Registers authentication-owned providers.
context-menu-config.ts Defines the public user-menu slot.
user-menu.tsx Renders registry-provided entries.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread assets/js/src/core/modules/auth/profile/user-menu-item.tsx Outdated
Comment thread assets/js/src/core/modules/notifications/user-menu-item.tsx Outdated
Comment thread assets/js/src/core/modules/auth/logout-user-menu-item.tsx Outdated
markus-moser and others added 3 commits August 24, 2026 15:26
The three providers repeated the numbers the config already declares, so the
exported positioning contract could drift from the real order. Matches how the
tree and grid providers read theirs.

Documents the slot in the Context Menu Registry guide: no context object, the
built-in provider names and priorities, the module-init constraint, and how to
hide a built-in entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@markus-moser
markus-moser merged commit ca248f3 into 2026.x Aug 24, 2026
1 check passed
@markus-moser
markus-moser deleted the feat/user-menu-slot branch August 24, 2026 13:35
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants