Server admin 26: ui-role-permissions (#694) #771

Closed
charles wants to merge 0 commits from serveradmin-26-ui-role-permissions into serveradmin
Owner

Task 26 of the Server administration plan: the role editor's permission list.

What it builds

  • screens::entity_settings::permission_list (new): the pieces shared with the channel Permissions tab (Task 31), copied from DLG/shared/PermissionComponents.tsx and PermissionComponents.module.css, in the original's default layout only (comfy, one column; spec §13):
    • search(placeholder, query, on_input): the input with its glass.
    • groups(..): .permCategories, 18 px gap and 16 px top margin.
    • group(Editor::{Role, Overwrite}, title, first, rows): a divider above every group but the first, and the uppercase 11 px heading. Its top margin is 4 px for roles and 2 px for overrides.
    • row(title, description, Control::{Switch(bool), TriState(TriState)}, disabled: Option<&str>, on_change): either a FormSwitch (14/20 label and description, and the label also flips it, as the original's clickable label) or the overrides toggle (widgets::tri_state). A disabled row has its non-empty reason as a tooltip.
    • empty(): "No permissions found".
  • guild::role_editor, under the two switches, as in RoleEditor.tsx:
    • "Use this button to quickly clear all permissions." with "Clear permissions" (Button small secondary, disabled for a role the user may not edit).
    • The "Permissions" subtitle.
    • The search, with the placeholder "Search permissions" (SEARCH_PERMISSIONS_DESCRIPTOR).
    • The store's groups (RoleEditorModel::groups). Each row's disabled reason is PermissionSwitchRow::disabled_text(), and every switch is disabled when !can_edit.
    • The empty state.
  • guild::roles::Message::{TogglePermission, ClearPermissions, SearchPermissions} become RoleAction::{TogglePermission, ClearPermissions, Search}. A toggle is sent only for a shown, enabled switch of a role the user may edit. A search is always sent, because searching does not change the role.
  • Strings come from the fork: RoleEditor.tsx ("Search permissions", "Permissions", "Use this button to quickly clear all permissions.", "No permissions found"). "Clear permissions" and the disabled reasons are already in core (Tasks 10 and 12).

Tests

  • crates/fluxer-ui/tests/roles_tab.rs: groups_and_rows_from_core_model, switch_emits_toggle, disabled_switch_emits_nothing_and_shows_reason (a locked role, and a permission the moderator lacks, both with tooltip; a free one without), search_filters_rows (typing into the field, the filtered rows, the empty state) and clear_permissions.
  • Goldens: role_permissions, role_permissions_search and role_permissions_moderator_disabled. They are rendered with the page scrolled 300 px by a wheel event so that the list is visible. References are in docs/screenshots/, and the table is in docs/screenshots/README.md.
  • Redrawn goldens: roles_tab, roles_tab_everyone, roles_tab_moderator_locked, roles_tab_dragging and role_context_menu. They changed because the list now shows below the editor's switches; the comparison thresholds were not changed.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. No FLUXER_DESKTOP_TESTS tests were run, because none apply.

Deviations and notes

  • When I started, origin/serveradmin at d4d95fcf did not compile (#766, #767). The branch carries the same two-line fix as b7c8f289, and serveradmin's own fix (817d9ce1) has since been merged in, so nothing extra remains in the diff.
  • PermissionLayout's dense and grid toggle (LayoutToggleButtons) is left out, as spec §13 decides.
  • The Electron app was not available for a side-by-side comparison. The dimensions come from PermissionComponents.module.css, FormSwitch.module.css and GuildRolesTab.module.css (.permHeaderRow, .permHelp, .permSearchRow, .permCategories, .emptyState).

Stacked on: origin/serveradmin-10-core-permission-lists, origin/serveradmin-25-ui-roles-tab (both already in serveradmin)

Closes #694

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

Task 26 of the Server administration plan: the role editor's permission list. ## What it builds - `screens::entity_settings::permission_list` (new): the pieces shared with the channel Permissions tab (Task 31), copied from `DLG/shared/PermissionComponents.tsx` and `PermissionComponents.module.css`, in the original's default layout only (comfy, one column; spec §13): - `search(placeholder, query, on_input)`: the input with its glass. - `groups(..)`: `.permCategories`, 18 px gap and 16 px top margin. - `group(Editor::{Role, Overwrite}, title, first, rows)`: a divider above every group but the first, and the uppercase 11 px heading. Its top margin is 4 px for roles and 2 px for overrides. - `row(title, description, Control::{Switch(bool), TriState(TriState)}, disabled: Option<&str>, on_change)`: either a `FormSwitch` (14/20 label and description, and the label also flips it, as the original's clickable label) or the overrides toggle (`widgets::tri_state`). A disabled row has its non-empty reason as a tooltip. - `empty()`: "No permissions found". - `guild::role_editor`, under the two switches, as in `RoleEditor.tsx`: - "Use this button to quickly clear all permissions." with "Clear permissions" (`Button small` secondary, disabled for a role the user may not edit). - The "Permissions" subtitle. - The search, with the placeholder "Search permissions" (`SEARCH_PERMISSIONS_DESCRIPTOR`). - The store's groups (`RoleEditorModel::groups`). Each row's disabled reason is `PermissionSwitchRow::disabled_text()`, and every switch is disabled when `!can_edit`. - The empty state. - `guild::roles::Message::{TogglePermission, ClearPermissions, SearchPermissions}` become `RoleAction::{TogglePermission, ClearPermissions, Search}`. A toggle is sent only for a shown, enabled switch of a role the user may edit. A search is always sent, because searching does not change the role. - Strings come from the fork: `RoleEditor.tsx` ("Search permissions", "Permissions", "Use this button to quickly clear all permissions.", "No permissions found"). "Clear permissions" and the disabled reasons are already in core (Tasks 10 and 12). ## Tests - `crates/fluxer-ui/tests/roles_tab.rs`: `groups_and_rows_from_core_model`, `switch_emits_toggle`, `disabled_switch_emits_nothing_and_shows_reason` (a locked role, and a permission the moderator lacks, both with tooltip; a free one without), `search_filters_rows` (typing into the field, the filtered rows, the empty state) and `clear_permissions`. - Goldens: `role_permissions`, `role_permissions_search` and `role_permissions_moderator_disabled`. They are rendered with the page scrolled 300 px by a wheel event so that the list is visible. References are in `docs/screenshots/`, and the table is in `docs/screenshots/README.md`. - Redrawn goldens: `roles_tab`, `roles_tab_everyone`, `roles_tab_moderator_locked`, `roles_tab_dragging` and `role_context_menu`. They changed because the list now shows below the editor's switches; the comparison thresholds were not changed. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. No FLUXER_DESKTOP_TESTS tests were run, because none apply. ## Deviations and notes - When I started, `origin/serveradmin` at d4d95fcf did not compile (#766, #767). The branch carries the same two-line fix as b7c8f289, and serveradmin's own fix (817d9ce1) has since been merged in, so nothing extra remains in the diff. - `PermissionLayout`'s dense and grid toggle (`LayoutToggleButtons`) is left out, as spec §13 decides. - The Electron app was not available for a side-by-side comparison. The dimensions come from `PermissionComponents.module.css`, `FormSwitch.module.css` and `GuildRolesTab.module.css` (`.permHeaderRow`, `.permHelp`, `.permSearchRow`, `.permCategories`, `.emptyState`). Stacked on: origin/serveradmin-10-core-permission-lists, origin/serveradmin-25-ui-roles-tab (both already in serveradmin) Closes #694 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Task 29's channel confirm lacked Task 27's ConfirmModel::waiting, and
main::Modal::ALL counted 28 of its 29 layers. Same change as b7c8f289
(serveradmin-33) and 50180b28 (serveradmin-30); see #766, #767.

Refs #694

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
The role editor's permission section (RoleEditor.tsx, PermissionComponents.tsx):
"Clear permissions" with its help text, the "Permissions" subtitle, the search,
the store's groups with their switches, disabled with the store's reason as the
tooltip, and "No permissions found". The group, row and search pieces live in
screens::entity_settings::permission_list, generic over a switch or the
tri-state buttons for the channel Permissions tab. Goldens role_permissions,
role_permissions_search, role_permissions_moderator_disabled; the Roles tab's
goldens redrawn, as the list now shows under the editor's switches.

Refs #694

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
# Conflicts:
#	crates/fluxer-ui/src/screens/entity_settings/channel/mod.rs
Author
Owner

Review: Server admin 26 (ui-role-permissions), reviewed at 015ad342 (diff 88c60f8b..HEAD)

Plan tests: groups_and_rows_from_core_model, switch_emits_toggle, disabled_switch_emits_nothing_and_shows_reason, search_filters_rows, clear_permissions are all in crates/fluxer-ui/tests/roles_tab.rs and assert what the plan asks: the store's group and row order, a toggle from both the switch and its label, nothing sent from a locked or lacking row plus a tooltip check, search filtering and "No permissions found", and Clear disabled on a locked role. The goldens role_permissions, role_permissions_search and role_permissions_moderator_disabled are present, in the README table and in the suite.

Interfaces: permission_list::{group, row} take Control::{Switch, TriState}, plus search, groups, empty and Editor::{Role, Overwrite}, which is what Task 31 needs. RoleEditorModel::groups and PermissionSwitchRow::disabled_text() come from the core, and the UI does no permission logic of its own.

Invariants: no I/O, no new dependencies, no fixtures, no secrets. The UI's update re-checks can_edit and row.disabled before emitting TogglePermission or ClearPermissions.

Parity spot-checks (fluxer-soundboard):

  • RoleEditor.tsx: the placeholder SEARCH_PERMISSIONS_DESCRIPTOR is "Search permissions" (no ellipsis), so the implementer's choice is correct. "Use this button to quickly clear all permissions.", "Clear permissions" (secondary small button, disabled when selectedRoleLocked || !canManageRoles), the "Permissions" subtitle, and the empty state only when the query is non-empty all match.
  • PermissionComponents.tsx PermissionRoleCategory/PermissionRoleToggle: the divider is drawn when !isFirst, a row is disabled when disabled || reason, and the tooltip shows only when there is text, all as implemented. getPermissionWarning (GuildRolesTab.tsx) only returns the would-remove-own text, which getPermissionDisabledReason already covers, so leaving it out loses nothing.
  • CSS: .permCategories gap 1.125rem / margin-top 1rem, .roleCategoryContainer gap 0.5rem, .roleCategoryPermissions gap 0.25rem, .roleCategoryTitle margin 0.25rem 0 0.125rem / 0.6875rem, .categoryTitle margin-top 0.125rem, .overwriteToggle gap 0.75rem / padding 0.375rem, .emptyState padding 1rem / 0.875rem, .permHelp 0.8125rem muted. All match the constants.

Findings

  • minor: the Control::TriState path of permission_list::row has no test (the implementer says so). Task 31's tri_state_emits_set and disabled_reason_tooltip should cover it.
  • minor: spec §3.1 row 20 (dense/comfy and two-column layout toggles) is marked 10. The Global Constraints want a later (10) row in docs/parity/serveradmin.md, and that file does not exist yet. Task 34 should add it.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci at 015ad342 reported "all steps passed", including the new and redrawn roles goldens on lavapipe.

Verdict: approved (0 blocking, 2 minor)

## Review: Server admin 26 (ui-role-permissions), reviewed at 015ad342 (diff 88c60f8b..HEAD) **Plan tests**: `groups_and_rows_from_core_model`, `switch_emits_toggle`, `disabled_switch_emits_nothing_and_shows_reason`, `search_filters_rows`, `clear_permissions` are all in `crates/fluxer-ui/tests/roles_tab.rs` and assert what the plan asks: the store's group and row order, a toggle from both the switch and its label, nothing sent from a locked or lacking row plus a tooltip check, search filtering and "No permissions found", and Clear disabled on a locked role. The goldens `role_permissions`, `role_permissions_search` and `role_permissions_moderator_disabled` are present, in the README table and in the suite. **Interfaces**: `permission_list::{group, row}` take `Control::{Switch, TriState}`, plus `search`, `groups`, `empty` and `Editor::{Role, Overwrite}`, which is what Task 31 needs. `RoleEditorModel::groups` and `PermissionSwitchRow::disabled_text()` come from the core, and the UI does no permission logic of its own. **Invariants**: no I/O, no new dependencies, no fixtures, no secrets. The UI's `update` re-checks `can_edit` and `row.disabled` before emitting `TogglePermission` or `ClearPermissions`. **Parity spot-checks** (fluxer-soundboard): - `RoleEditor.tsx`: the placeholder `SEARCH_PERMISSIONS_DESCRIPTOR` is "Search permissions" (no ellipsis), so the implementer's choice is correct. "Use this button to quickly clear all permissions.", "Clear permissions" (secondary small button, disabled when `selectedRoleLocked || !canManageRoles`), the "Permissions" subtitle, and the empty state only when the query is non-empty all match. - `PermissionComponents.tsx` `PermissionRoleCategory`/`PermissionRoleToggle`: the divider is drawn when `!isFirst`, a row is disabled when `disabled || reason`, and the tooltip shows only when there is text, all as implemented. `getPermissionWarning` (`GuildRolesTab.tsx`) only returns the would-remove-own text, which `getPermissionDisabledReason` already covers, so leaving it out loses nothing. - CSS: `.permCategories` gap 1.125rem / margin-top 1rem, `.roleCategoryContainer` gap 0.5rem, `.roleCategoryPermissions` gap 0.25rem, `.roleCategoryTitle` margin 0.25rem 0 0.125rem / 0.6875rem, `.categoryTitle` margin-top 0.125rem, `.overwriteToggle` gap 0.75rem / padding 0.375rem, `.emptyState` padding 1rem / 0.875rem, `.permHelp` 0.8125rem muted. All match the constants. **Findings** - minor: the `Control::TriState` path of `permission_list::row` has no test (the implementer says so). Task 31's `tri_state_emits_set` and `disabled_reason_tooltip` should cover it. - minor: spec §3.1 row 20 (dense/comfy and two-column layout toggles) is marked `10`. The Global Constraints want a `later (10)` row in `docs/parity/serveradmin.md`, and that file does not exist yet. Task 34 should add it. **Local gate**: `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` at 015ad342 reported "all steps passed", including the new and redrawn roles goldens on lavapipe. **Verdict: approved** (0 blocking, 2 minor)
Author
Owner

Merged into serveradmin by hand (the merge API returns 405); the commits are in the branch.

Merged into `serveradmin` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-16 11:30:58 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.