Skip to content

Commit 90a63c5

Browse files
JonasBacursoragent
authored andcommitted
feat(cmd-k): Add 'superuser' keyword to admin actions (#112298)
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Description Adds the `superuser` keyword to all admin CMD-K actions and restores the "Open Superuser Modal" action from the old command palette to match the old workflow and improve discoverability. Also updates the organization admin URL to use the correct customers endpoint. This addresses the issue where users were trying to search for "superuser" in the new CMD-K but couldn't find the admin actions or the superuser escalation modal. ## Changes - Added `keywords: [t('superuser')]` to "Open _admin" action - Added `keywords: [t('superuser')]` to "Open org in _admin" action - Added `keywords: [t('superuser')]` to "Exit Superuser" action - **Added "Open Superuser Modal" action** - allows staff users to escalate to superuser mode (only shown when not already a superuser) - Changed organization admin URL from `/_admin/organizations/${organization.slug}/` to `/_admin/customers/${organization.slug}/` ## Testing Users can now type "superuser" in CMD-K and see: - "Open _admin" - opens the Django admin interface - "Open org in _admin" - opens the organization's customer page in Django admin - "Open Superuser Modal" - opens the authentication modal to escalate to superuser (only shown when not already superuser) - "Exit Superuser" - exits superuser mode (only shown when already superuser) <!-- CURSOR_AGENT_PR_BODY_END --> [Slack Thread](https://sentry.slack.com/archives/C08QLT0PYQK/p1775510843648239?thread_ts=1775510843.648239&cid=C08QLT0PYQK) <div><a href="https://cursor.com/agents/bc-3faa6305-783b-5a27-be62-31d6ae10d612"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-3faa6305-783b-5a27-be62-31d6ae10d612"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Jonas <JonasBa@users.noreply.github.com>
1 parent 328b74c commit 90a63c5

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

static/app/components/commandPalette/useGlobalCommandPaletteActions.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {ProjectAvatar} from '@sentry/scraps/avatar';
66

77
import {addLoadingMessage, addSuccessMessage} from 'sentry/actionCreators/indicator';
88
import {openInviteMembersModal} from 'sentry/actionCreators/modal';
9+
import {openSudo} from 'sentry/actionCreators/sudoModal';
910
import {useCommandPaletteActionsRegister} from 'sentry/components/commandPalette/context';
1011
import type {
1112
CMDKQueryOptions,
@@ -350,27 +351,46 @@ export function useGlobalCommandPaletteActions() {
350351
label: t('Open _admin'),
351352
icon: <IconOpen />,
352353
},
354+
keywords: [t('superuser')],
353355
onAction: () => window.open('/_admin/', '_blank', 'noreferrer'),
354356
},
355357
{
356358
display: {
357359
label: t('Open %s in _admin', organization.name),
358360
icon: <IconOpen />,
359361
},
362+
keywords: [t('superuser')],
360363
onAction: () =>
361364
window.open(
362-
`/_admin/organizations/${organization.slug}/`,
365+
`/_admin/customers/${organization.slug}/`,
363366
'_blank',
364367
'noreferrer'
365368
),
366369
},
370+
...(isActiveSuperuser()
371+
? []
372+
: [
373+
{
374+
display: {
375+
label: t('Open Superuser Modal'),
376+
icon: <IconLock locked />,
377+
},
378+
keywords: [t('superuser')],
379+
onAction: () =>
380+
openSudo({
381+
isSuperuser: true,
382+
needsReload: true,
383+
}),
384+
},
385+
]),
367386
...(isActiveSuperuser()
368387
? [
369388
{
370389
display: {
371390
label: t('Exit Superuser'),
372391
icon: <IconLock locked={false} />,
373392
},
393+
keywords: [t('superuser')],
374394
onAction: () => exitSuperuser(),
375395
},
376396
]

0 commit comments

Comments
 (0)