Server admin 13: fluxer-core member moderation: nickname, roles, timeout, kick, ban #680

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

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

Closes: — (refs #640)
Depends on: 9b

Files:

  • Modify: crates/fluxer-core/src/admin/members.rs
  • Test: crates/fluxer-core/tests/admin_members.rs

Interfaces:

  • Produces: MemberAction::ToggleRole { guild, user, role } → AddMemberRole/RemoveMemberRole at once, the member's roles changed optimistically and reverted on failure (AM/items/GuildMemberMenuItems.tsx, feat/member/commands/GuildMemberCommands.ts); members::roles_menu(app, guild, user) -> Vec<RoleCheck { role, name, color, checked, enabled }> (every role but @everyone, by position; enabled with MANAGE_ROLES and can_manage_role).

  • Modals as app.admin.moderation with their models (members::modal(app) -> Option<ModerationModalModel>): nickname (BaseChangeNicknameModal.tsx: ≤ 32, empty clears; UpdateOwnMember for oneself, UpdateMember otherwise), timeout (TimeoutMemberOptions.ts: 60 s, 5 min, 10 min, 1 h default, 1 d, 1 w; reason ≤ 512; communication_disabled_until = now + d through the store's clock), remove timeout (Confirm::RemoveTimeout; null), kick (Confirm::KickMember, no reason), ban (BanMemberModal.tsx: the ten durations with Custom 60–63 072 000 s, the seven history options with 24 h default, reason ≤ 512; BanMember). Each closes on its answer; failures map to the original's texts (MISSING_PERMISSIONS, UNKNOWN_MEMBER, TIMEOUT_CANNOT_EXCEED_365_DAYS, TWO_FACTOR_REQUIRED, default); the member leaves the store through GUILD_MEMBER_REMOVE / GUILD_BAN_ADD.

  • A target whose member record is not cached: MemberAction::Open* first asks for the member (the request the profile popout already uses) and opens when it arrives; moderation_caps is None until then.

  • Step 1: Write failing tests: toggle_role_puts_and_deletes, toggle_role_reverts_on_failure, roles_menu_enabled_by_hierarchy, nickname_self_goes_to_me, empty_nickname_clears, timeout_options_and_iso_time, remove_timeout_sends_null, kick_confirms_and_has_no_reason, ban_body_from_form_defaults, custom_ban_duration_clamped, failure_texts_by_code, modal_closes_on_answer_member_removed_by_event, uncached_target_is_fetched_first.

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

Task 13 of the Server administration plan (`docs/superpowers/plans/2026-11-15-serveradmin.md`, section "### Task 13:"). The plan on the `serveradmin` branch is the source of truth; this copy is for reading. **Closes:** — (refs #640) **Depends on:** 9b **Files:** - Modify: `crates/fluxer-core/src/admin/members.rs` - Test: `crates/fluxer-core/tests/admin_members.rs` **Interfaces:** - Produces: `MemberAction::ToggleRole { guild, user, role }` → `AddMemberRole`/`RemoveMemberRole` at once, the member's roles changed optimistically and reverted on failure (`AM/items/GuildMemberMenuItems.tsx`, `feat/member/commands/GuildMemberCommands.ts`); `members::roles_menu(app, guild, user) -> Vec<RoleCheck { role, name, color, checked, enabled }>` (every role but @everyone, by position; enabled with MANAGE_ROLES and `can_manage_role`). - Modals as `app.admin.moderation` with their models (`members::modal(app) -> Option<ModerationModalModel>`): nickname (`BaseChangeNicknameModal.tsx`: ≤ 32, empty clears; `UpdateOwnMember` for oneself, `UpdateMember` otherwise), timeout (`TimeoutMemberOptions.ts`: 60 s, 5 min, 10 min, 1 h default, 1 d, 1 w; reason ≤ 512; `communication_disabled_until = now + d` through the store's clock), remove timeout (`Confirm::RemoveTimeout`; `null`), kick (`Confirm::KickMember`, no reason), ban (`BanMemberModal.tsx`: the ten durations with Custom 60–63 072 000 s, the seven history options with 24 h default, reason ≤ 512; `BanMember`). Each closes on its answer; failures map to the original's texts (`MISSING_PERMISSIONS`, `UNKNOWN_MEMBER`, `TIMEOUT_CANNOT_EXCEED_365_DAYS`, `TWO_FACTOR_REQUIRED`, default); the member leaves the store through `GUILD_MEMBER_REMOVE` / `GUILD_BAN_ADD`. - A target whose member record is not cached: `MemberAction::Open*` first asks for the member (the request the profile popout already uses) and opens when it arrives; `moderation_caps` is `None` until then. - [ ] **Step 1: Write failing tests**: `toggle_role_puts_and_deletes`, `toggle_role_reverts_on_failure`, `roles_menu_enabled_by_hierarchy`, `nickname_self_goes_to_me`, `empty_nickname_clears`, `timeout_options_and_iso_time`, `remove_timeout_sends_null`, `kick_confirms_and_has_no_reason`, `ban_body_from_form_defaults`, `custom_ban_duration_clamped`, `failure_texts_by_code`, `modal_closes_on_answer_member_removed_by_event`, `uncached_target_is_fetched_first`. - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(core): member moderation`.
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#680
No description provided.