Skip to content

fix: persist welcome-dialog dismissal when Desktop Mode is disabled#303

Merged
epeicher merged 1 commit into
trunkfrom
fix/welcome-dialog-dismissal-persist
Jun 8, 2026
Merged

fix: persist welcome-dialog dismissal when Desktop Mode is disabled#303
epeicher merged 1 commit into
trunkfrom
fix/welcome-dialog-dismissal-persist

Conversation

@epeicher

@epeicher epeicher commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Problem

The first-run Welcome to Desktop Mode dialog re-appears on every classic-admin page load and can never be dismissed for good, even after clicking Got it / × / Escape.

It is, by design, an invite shown in the classic admin only while Desktop Mode is disabled for the user. Dismissing it POSTs the activation-welcome slug to POST /desktop-mode/v1/intros/seen to remember the dismissal. But that route's permission callback is desktop_mode_rest_require_enabled(), which returns 403 whenever Desktop Mode is not enabled, which is the only state the dialog ever appears in. So the dismissal could never persist → the dialog showed forever.

This is a Catch-22 introduced when the seen-intros route was hardened to require Desktop Mode enabled (previously read), while the welcome dialog, added later, reused that same endpoint.

Fix

Scope a single-slug exception in desktop_mode_rest_seen_intros_permission():

  • The activation-welcome slug is accepted from any logged-in, read-capable account (the exact audience the dialog is shown to). Writing one's own dismissal flag carries no privileged surface.
  • Every other (in-shell) intro slug still requires Desktop Mode enabled.
  • The DELETE /intros ("Reset what's-new dialogs") route carries no slug and is unaffected.

Net behavior: the welcome invite now shows once after activation, stays dismissed, and never shows once Desktop Mode is enabled.

Tests

  • New regression test: a logged-in, not-enabled user can persist the activation-welcome dismissal (200, recorded).
  • New scope test: a not-enabled user posting any other slug (e.g. posts) is still rejected (403).
  • Full suites green: build, lint, typecheck, test:js (1568), test:php for the affected classes (20 tests).

Docs

Updated the desktop_mode_show_welcome_dialog entry in docs/hooks-reference.md to document the not-enabled gate and the scoped dismissal-persistence exception.

Open WordPress Playground Preview

The first-run "Welcome to Desktop Mode" dialog renders in the classic
admin only while Desktop Mode is *disabled* (it is a "switch to Desktop
Mode" promo). Its dismissal POSTs the `activation-welcome` slug to
/desktop-mode/v1/intros/seen, but that route's permission callback is
desktop_mode_rest_require_enabled(), which returns 403 whenever Desktop
Mode is not enabled. Because that is the only state the dialog ever
appears in, the dismissal could never persist, so the dialog re-rendered
on every classic-admin page load.

Scope a single-slug exception in desktop_mode_rest_seen_intros_permission():
the `activation-welcome` slug is accepted from any logged-in, read-capable
account (the exact audience the dialog is shown to), while every other
(in-shell) intro slug keeps the strict enabled gate. The DELETE /intros
"Reset what's-new dialogs" route carries no slug and is unaffected.

Adds regression tests covering both the welcome-slug bypass and the
unchanged strict gate for other slugs, and documents the dismissal
behavior in the welcome-dialog hook reference.
@epeicher epeicher merged commit 480e2cb into trunk Jun 8, 2026
5 checks passed
@epeicher epeicher deleted the fix/welcome-dialog-dismissal-persist branch June 8, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant