Server admin 12: fluxer-core roles: list, create, edit, permissions, reorder, duplicate, delete #679

Closed
opened 2026-11-15 19:01:13 +00:00 by charles · 0 comments
Owner

Task 12 of the Server administration plan (docs/superpowers/plans/2026-11-15-serveradmin.md, section "### Task 12:"). The plan on the serveradmin branch is the source of truth; this copy is for reading.

Closes: —
Depends on: 10, 11

Files:

  • Modify: crates/fluxer-core/src/admin/roles.rs
  • Test: crates/fluxer-core/tests/admin_roles.rs

Interfaces:

  • Produces: admin::roles::model(app) -> RolesModel { list: Vec<RoleRow { id, name, color, locked, selected, draggable }>, can_create, editor: Option<RoleEditorModel { name, color, hoist, mentionable, is_everyone, locked, groups: Vec<PermissionGroupModel>, search }> } (roles by position, highest first, @everyone last; GT/GuildRolesTab.tsx, GT/guild_roles_tab/*); RoleAction::Create → CreateRole { name: "New role" }, selected when its GUILD_ROLE_CREATE arrives (MAX_GUILD_ROLES → the original's text); Edit, TogglePermission (through perm_spec::role_switch; a blocked switch changes nothing), ClearPermissions into edits; Move(RoleMove { role, target }) into the pending order (GT/RoleMoveOperation.ts, GT/RoleReorderStateMachine.ts: a locked role cannot move and cannot be crossed in a way the server would refuse; @everyone never moves); the bar's save: one UpdateRole per changed role with only its changed fields and masked permissions, then UpdateRolePositions with the order without @everyone and locked roles (feat/guild/utils/GuildRoleOrderUtils.ts createSubmittableRoleOrderIds); the form is clean when every answer is in; a failure keeps the remaining edits and shows the message; RESOURCE_LOCKED retries the order once after 1 s.

  • Duplicate (AM/RoleContextMenu.tsx): create "{name} copy" (cut to 100) with permissions & mine, then UpdateRole { hoist, mentionable }, then the order placing it below the source; Delete → Confirm::DeleteRole from the editor, immediate from the context menu; not for @everyone or a locked role; roles::context_menu(app, role) -> MenuModel ("Copy role ID", "Duplicate role", "Delete role").

  • Step 1: Write failing tests: list_order_and_everyone_last, create_selects_on_event, max_roles_error_text, edits_accumulate_per_role, blocked_switch_changes_nothing, clear_permissions, move_within_manageable_roles, locked_role_cannot_move_or_be_crossed, save_sends_changed_roles_then_order_without_everyone_and_locked, partial_failure_keeps_remaining_edits, resource_locked_retries_once, duplicate_three_requests_in_order, delete_confirms_in_editor_not_in_menu, everyone_shows_permissions_only, role_deleted_elsewhere_drops_its_edits_and_selection, bulk_event_while_dragging_keeps_pending_order_valid.

  • Step 2–5: FAIL → implement → PASS → commit feat(core): roles.

Task 12 of the Server administration plan (`docs/superpowers/plans/2026-11-15-serveradmin.md`, section "### Task 12:"). The plan on the `serveradmin` branch is the source of truth; this copy is for reading. **Closes:** — **Depends on:** 10, 11 **Files:** - Modify: `crates/fluxer-core/src/admin/roles.rs` - Test: `crates/fluxer-core/tests/admin_roles.rs` **Interfaces:** - Produces: `admin::roles::model(app) -> RolesModel { list: Vec<RoleRow { id, name, color, locked, selected, draggable }>, can_create, editor: Option<RoleEditorModel { name, color, hoist, mentionable, is_everyone, locked, groups: Vec<PermissionGroupModel>, search }> }` (roles by position, highest first, @everyone last; `GT/GuildRolesTab.tsx`, `GT/guild_roles_tab/*`); `RoleAction::Create` → `CreateRole { name: "New role" }`, selected when its `GUILD_ROLE_CREATE` arrives (`MAX_GUILD_ROLES` → the original's text); `Edit`, `TogglePermission` (through `perm_spec::role_switch`; a blocked switch changes nothing), `ClearPermissions` into `edits`; `Move(RoleMove { role, target })` into the pending `order` (`GT/RoleMoveOperation.ts`, `GT/RoleReorderStateMachine.ts`: a locked role cannot move and cannot be crossed in a way the server would refuse; @everyone never moves); the bar's save: one `UpdateRole` per changed role with only its changed fields and masked permissions, then `UpdateRolePositions` with the order without @everyone and locked roles (`feat/guild/utils/GuildRoleOrderUtils.ts` `createSubmittableRoleOrderIds`); the form is clean when every answer is in; a failure keeps the remaining edits and shows the message; `RESOURCE_LOCKED` retries the order once after 1 s. - `Duplicate` (`AM/RoleContextMenu.tsx`): create "{name} copy" (cut to 100) with `permissions & mine`, then `UpdateRole { hoist, mentionable }`, then the order placing it below the source; `Delete` → `Confirm::DeleteRole` from the editor, immediate from the context menu; not for @everyone or a locked role; `roles::context_menu(app, role) -> MenuModel` ("Copy role ID", "Duplicate role", "Delete role"). - [ ] **Step 1: Write failing tests**: `list_order_and_everyone_last`, `create_selects_on_event`, `max_roles_error_text`, `edits_accumulate_per_role`, `blocked_switch_changes_nothing`, `clear_permissions`, `move_within_manageable_roles`, `locked_role_cannot_move_or_be_crossed`, `save_sends_changed_roles_then_order_without_everyone_and_locked`, `partial_failure_keeps_remaining_edits`, `resource_locked_retries_once`, `duplicate_three_requests_in_order`, `delete_confirms_in_editor_not_in_menu`, `everyone_shows_permissions_only`, `role_deleted_elsewhere_drops_its_edits_and_selection`, `bulk_event_while_dragging_keeps_pending_order_valid`. - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(core): roles`.
charles referenced this issue from a commit 2026-11-16 03:17:18 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#679
No description provided.