Skip to content

Conversation

@ZogStriP
Copy link
Member

When moderators with moderators_manage_categories enabled change category permissions, they could accidentally remove their own access, requiring admin intervention to fix.

This adds a client-side confirmation dialog that warns moderators before saving permission changes that would lock them out. If confirmed, the changes are saved and the user is redirected to the home page.

Changes:

  • Add _wouldLoseAccess() check in edit-category controller that compares new permissions against the user's group memberships
  • Show confirmation dialog via dialog.yesNoConfirm() before saving
  • Redirect to home page after confirmed save (since user can no longer access the category edit page)
  • Fix onSelectGroup to properly set group_id for custom groups by looking up from site.groups (was only working for auto groups)

Here's how the confirm dialog looks like

CleanShot 2025-12-12 at 17 12 55

Ref - https://meta.discourse.org/t/390978

When moderators with `moderators_manage_categories` enabled change
category permissions, they could accidentally remove their own access,
requiring admin intervention to fix.

This adds a client-side confirmation dialog that warns moderators
before saving permission changes that would lock them out. If confirmed,
the changes are saved and the user is redirected to the home page.

Changes:
- Add `_wouldLoseAccess()` check in edit-category controller that
  compares new permissions against the user's group memberships
- Show confirmation dialog via `dialog.yesNoConfirm()` before saving
- Redirect to home page after confirmed save (since user can no longer
  access the category edit page)
- Fix `onSelectGroup` to properly set `group_id` for custom groups by
  looking up from `site.groups` (was only working for auto groups)

Ref - https://meta.discourse.org/t/390978
@github-actions github-actions bot added the i18n PRs which update English locale files or i18n related code label Dec 12, 2025
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/moderators-can-create-change-categories-such-that-they-lose-access/390978/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n PRs which update English locale files or i18n related code

Development

Successfully merging this pull request may close these issues.

3 participants