Admin search ignores a settings or permissions item's own link
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, php, typescript
- Domain
- developer-experience, frontend
Research direction
Start in framework/core/js/src/admin/components/GeneralSearchSource.tsx and read lookup() around the settings and permissions result handling; compare it with the per-item link documented in framework/core/js/src/admin/states/GeneralSearchIndex.ts. Use each item's link when present, keeping the existing group and extension routes as fallbacks. Done means selecting either result opens its item link when set; check the relevant search tests or add coverage for settings and permissions.
Written by the indexing model from the issue text.
Description
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
- Register a settings index item with a
linkpointing at a sub-page or tab of an extension, as above. - In the admin, search for the setting's label.
- 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.
- Dominant language
- PHP
- Stars
- 6.8k
- Forks
- 887
- Avg merge
- 12h 6m
- Merged PRs (30d)
- 127
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flarum/framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
type/extensibility
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
All issues in flarum/framework
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
-
module: user interface priority: high severity: minor type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[Enhancement] Add a dark-bg Tailwind variantPossibly taken @bd-viget claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
vigetlabs/wordpress-site-starter#306 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Spomky-Labs/pwa-bundle#476 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day