Skip to content

Admin search ignores a settings or permissions item's own link #5254

Open

Description

@imorland

Current Behavior

In the admin search, a setting or permission result always opens the extension's main page, even when the indexed item provides its own link.

GeneralIndexItem documents a per-item link:

// framework/core/js/src/admin/states/GeneralSearchIndex.ts:18-22
/**
 * Optional: The URL to navigate to when this item is selected.
 * The default is to navigate to the extension page.
 */
link?: string;

But GeneralSearchSource.lookup() never reads it. Both settings and permissions results use only the group link or the extension route:

// framework/core/js/src/admin/components/GeneralSearchSource.tsx:126 (settings) and :160 (permissions)
group?.link || (corePage ? app.route(corePage) : app.route('extension', { id: extensionId })),

So an extension with tabbed settings, for example using a page route parameter, can't send a search hit to the tab that holds the setting:

app.generalIndex.for('acme-example').add('settings', [
  {
    id: 'acme-example.moderation.thing',
    label: 'Moderation thing',
    tree: ['Moderation'],
    link: app.route('extension', { id: 'acme-example', page: 'moderation' }), // ignored
  },
]);

Steps to Reproduce

  1. Register a settings index item with a link pointing at a sub-page or tab of an extension, as above.
  2. In the admin, search for the setting's label.
  3. Selecting the result opens the extension's default page, not the link.

Expected Behavior

The item's own link is used when present, and the group link or extension route remains the fallback.

Environment

  • Flarum version: 2.x (2.0.2)

Possible Solution

('link' in setting && setting.link) || group?.link || (corePage ? app.route(corePage) : app.route('extension', { id: extensionId })),

Do the same for permissions. registerSetting options could also accept link, so registry-defined settings can point at a tab.

Additional Context

Found while planning tabbed settings for fof/anti-spam. In the meantime, results land on the first tab, with the tree breadcrumb naming the right one.

Activity

  1. added this to the 2.1 milestone on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions