Server admin 27: ui-menus-moderation-modals (#695) #762

Closed
charles wants to merge 0 commits from serveradmin-27-ui-menus-moderation-modals into serveradmin
Owner

Stacked on: serveradmin-8-form-widgets, serveradmin-13-core-member-moderation, serveradmin-20-core-menu-rows (8 and 13 were already on serveradmin; only 20 was merged in).

What this builds (Server administration Task 27; spec §3.1 rows 36, 59–68, §3.5, §3.6)

  • Menus (screens/main/menus/mod.rs): the store's administration rows drawn in its order with the original's icons (ContextMenuIcons.tsx): Edit channel/category = GearIcon, Duplicate channel = CopySimpleIcon, Delete = TrashIcon, Change nickname = PencilSimpleIcon, Transfer ownership = CrownIcon, Timeout/Remove timeout = ClockIcon, Kick = BootIcon, Ban = GavelIcon (three new Phosphor 2.1.10 fill SVGs). "Roles ▸" with MANAGE_ROLES is a list of checkbox rows with each role's colour dot (ManageRolesMenuItem, GuildMemberMenuItems.module.css; int2rgb(0) = rgb(219,222,225) for no colour). A click sends MemberAction::ToggleRole and leaves the menu and its submenu open (closeOnChange={false}); roles the user may not manage are faded and do nothing. "Community settings ▸" lists the tabs (core). Shift on "Duplicate channel" goes through fluxer_core::menus::with_shift (copies at once).
  • Modals modals/{nickname,timeout,ban}.rs: "Change nickname" (BaseChangeNicknameModal.tsx), "Time out {tag}" (TimeoutMemberModal.tsx: the six durations with 1 hour chosen, reason textarea of 3 rows and up to 512 characters, the activity-log hint, Cancel and the red "Timeout"), "Ban {tag}" (BanMemberModal.tsx: ten durations with "Custom…" and its seconds field clamped to 60–63072000, seven history radios defaulting to 24 h, reason up to 512 characters, Cancel and the red "Ban member"). The store decides which one is open (admin::members::modal). The fields live in menus::State::moderation and are dropped once the store closes the modal (Moderation::sync, called at the top of main::update). The new layer is main::Modal::Moderation.
  • Generic confirm (message_actions/confirm.rs): Confirm::{KickMember, RemoveTimeout} use the store's texts (no reason for a kick), and their buttons wait while the request is on its way (ConfirmModel::waiting). Confirm::DeleteChannel covers channel and category (delete_confirm). Confirm::AnnouncementOff shows "Stop being an announcement channel?" with "Convert". All primary buttons are red.

Strings come from the fork's English source: "Nickname", "Clear nickname", "Save", "Timeout duration", "How long they stay timed out.", "Reason (optional)", "This reason will be displayed in the activity log in Community settings > Activity log.", "Ban duration", "How long they stay banned.", "Delete message history", "Enter a reason for the ban", "Cancel", "Timeout", "Ban member", "Something went wrong", "Close".

Deviations from the plan and the original

  • widgets/context_menu.rs gains Item::Check { label, checked, disabled, swatch, on_toggle }, the checkbox row with a colour dot. Item::Toggle has no disabled state and no dot, and changing it would touch every caller. tests/menus_channel_guild.rs's exhaustive match gains the arm.
  • widgets/text_input.rs: Multiline::{without_counter, min_rows}. The original's timeout Textarea has no counter and uses minRows={3}.
  • The generic error modal ("Something went wrong", the store's admin.error, "Close" → DismissError) is drawn while no settings screen is open. Without it a refused role toggle, a refused kick or timeout removal, a channel delete or a reorder had no visible failure. Reorder errors use this generic title, not the original's own.
  • Nickname, timeout and ban refusals show inside the modal: under the field for the nickname, as the original does, and above the buttons for timeout and ban. The original opens a separate error modal for timeout and ban.
  • The ban modal has no banner artwork, as the original leaves it out on a self-hosted instance. The custom-seconds field keeps the digits as typed and clamps the value sent. The original rewrites the field on every keystroke, which makes "3600" impossible to type in a native field.
  • Some files fall outside the task's Files list: widgets/{context_menu,text_input}.rs and tests/menus_channel_guild.rs (above), main/mod.rs (one modal layer and the sync line), and crates/fluxer-ui/README.md.
  • The tests were written alongside the implementation, not run red first. I did not run them against the old code.

How it was tested

  • New headless tests: tests/menus_admin.rs (menu_rows_drawn_in_core_order, roles_submenu_checkbox_emits_toggle_and_stays_open, settings_submenu_rows, shift_duplicate_flag) and tests/moderation_modals.rs (nickname_modal_max_and_clear, timeout_modal_options_and_reason, ban_modal_defaults_custom_duration_and_reason, confirm_strings_for_each_new_variant).
  • 11 new goldens: member_menu_moderation, member_menu_roles_checkboxes, guild_menu_settings_submenu, channel_menu_admin, category_menu_admin, nickname_modal, timeout_modal, ban_modal, kick_confirm, delete_channel_confirm, delete_category_confirm. Each has its reference in docs/screenshots/ and a row in its README. Dimensions come from BanMemberModal.module.css, FormCombobox.module.css, GuildMemberMenuItems.module.css and Modal.module.css. No Electron side-by-side reference was taken.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passes locally. No FLUXER_DESKTOP_TESTS tests were run.

Closes #695
Closes #640

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

Stacked on: serveradmin-8-form-widgets, serveradmin-13-core-member-moderation, serveradmin-20-core-menu-rows (8 and 13 were already on serveradmin; only 20 was merged in). ## What this builds (Server administration Task 27; spec §3.1 rows 36, 59–68, §3.5, §3.6) - **Menus** (`screens/main/menus/mod.rs`): the store's administration rows drawn in its order with the original's icons (`ContextMenuIcons.tsx`): Edit channel/category = `GearIcon`, Duplicate channel = `CopySimpleIcon`, Delete = `TrashIcon`, Change nickname = `PencilSimpleIcon`, Transfer ownership = `CrownIcon`, Timeout/Remove timeout = `ClockIcon`, Kick = `BootIcon`, Ban = `GavelIcon` (three new Phosphor 2.1.10 fill SVGs). "Roles ▸" with MANAGE_ROLES is a list of checkbox rows with each role's colour dot (`ManageRolesMenuItem`, `GuildMemberMenuItems.module.css`; `int2rgb(0)` = rgb(219,222,225) for no colour). A click sends `MemberAction::ToggleRole` and leaves the menu and its submenu open (`closeOnChange={false}`); roles the user may not manage are faded and do nothing. "Community settings ▸" lists the tabs (core). Shift on "Duplicate channel" goes through `fluxer_core::menus::with_shift` (copies at once). - **Modals** `modals/{nickname,timeout,ban}.rs`: "Change nickname" (`BaseChangeNicknameModal.tsx`), "Time out {tag}" (`TimeoutMemberModal.tsx`: the six durations with 1 hour chosen, reason textarea of 3 rows and up to 512 characters, the activity-log hint, Cancel and the red "Timeout"), "Ban {tag}" (`BanMemberModal.tsx`: ten durations with "Custom…" and its seconds field clamped to 60–63072000, seven history radios defaulting to 24 h, reason up to 512 characters, Cancel and the red "Ban member"). The store decides which one is open (`admin::members::modal`). The fields live in `menus::State::moderation` and are dropped once the store closes the modal (`Moderation::sync`, called at the top of `main::update`). The new layer is `main::Modal::Moderation`. - **Generic confirm** (`message_actions/confirm.rs`): `Confirm::{KickMember, RemoveTimeout}` use the store's texts (no reason for a kick), and their buttons wait while the request is on its way (`ConfirmModel::waiting`). `Confirm::DeleteChannel` covers channel and category (`delete_confirm`). `Confirm::AnnouncementOff` shows "Stop being an announcement channel?" with "Convert". All primary buttons are red. Strings come from the fork's English source: "Nickname", "Clear nickname", "Save", "Timeout duration", "How long they stay timed out.", "Reason (optional)", "This reason will be displayed in the activity log in Community settings > Activity log.", "Ban duration", "How long they stay banned.", "Delete message history", "Enter a reason for the ban", "Cancel", "Timeout", "Ban member", "Something went wrong", "Close". ## Deviations from the plan and the original - `widgets/context_menu.rs` gains `Item::Check { label, checked, disabled, swatch, on_toggle }`, the checkbox row with a colour dot. `Item::Toggle` has no disabled state and no dot, and changing it would touch every caller. `tests/menus_channel_guild.rs`'s exhaustive match gains the arm. - `widgets/text_input.rs`: `Multiline::{without_counter, min_rows}`. The original's timeout `Textarea` has no counter and uses `minRows={3}`. - The generic error modal ("Something went wrong", the store's `admin.error`, "Close" → `DismissError`) is drawn while no settings screen is open. Without it a refused role toggle, a refused kick or timeout removal, a channel delete or a reorder had no visible failure. Reorder errors use this generic title, not the original's own. - Nickname, timeout and ban refusals show inside the modal: under the field for the nickname, as the original does, and above the buttons for timeout and ban. The original opens a separate error modal for timeout and ban. - The ban modal has no banner artwork, as the original leaves it out on a self-hosted instance. The custom-seconds field keeps the digits as typed and clamps the value sent. The original rewrites the field on every keystroke, which makes "3600" impossible to type in a native field. - Some files fall outside the task's Files list: `widgets/{context_menu,text_input}.rs` and `tests/menus_channel_guild.rs` (above), `main/mod.rs` (one modal layer and the sync line), and `crates/fluxer-ui/README.md`. - The tests were written alongside the implementation, not run red first. I did not run them against the old code. ## How it was tested - New headless tests: `tests/menus_admin.rs` (`menu_rows_drawn_in_core_order`, `roles_submenu_checkbox_emits_toggle_and_stays_open`, `settings_submenu_rows`, `shift_duplicate_flag`) and `tests/moderation_modals.rs` (`nickname_modal_max_and_clear`, `timeout_modal_options_and_reason`, `ban_modal_defaults_custom_duration_and_reason`, `confirm_strings_for_each_new_variant`). - 11 new goldens: `member_menu_moderation`, `member_menu_roles_checkboxes`, `guild_menu_settings_submenu`, `channel_menu_admin`, `category_menu_admin`, `nickname_modal`, `timeout_modal`, `ban_modal`, `kick_confirm`, `delete_channel_confirm`, `delete_category_confirm`. Each has its reference in `docs/screenshots/` and a row in its README. Dimensions come from `BanMemberModal.module.css`, `FormCombobox.module.css`, `GuildMemberMenuItems.module.css` and `Modal.module.css`. No Electron side-by-side reference was taken. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passes locally. No `FLUXER_DESKTOP_TESTS` tests were run. Closes #695 Closes #640 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
The channel, category, guild and member menus draw the administration rows
with the original's icons; "Roles ▸" is a list of checkboxes with each role's
colour dot that stays open while roles are ticked (#640); Shift on "Duplicate
channel" copies at once. "Change nickname", "Timeout" and "Ban member" modals
(BaseChangeNicknameModal.tsx, TimeoutMemberModal.tsx, BanMemberModal.tsx);
the generic confirm draws kick, remove timeout, delete channel / category,
the announcement-off confirm and the generic error modal for admin.error.

Refs #695

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Refs #695

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Author
Owner

Independent review: Server admin 27 (ui-menus-moderation-modals)

I reviewed git diff 228bbd2e..origin/serveradmin-27-ui-menus-moderation-modals at 978f902e.

Local gate: I ran FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree. Result: "all steps passed", exit 0.

Checks

  1. Tests the plan names: all 8 headless tests are present (menus_admin.rs, moderation_modals.rs). All 11 goldens are in screenshots.rs, fixtures/golden/ and docs/screenshots/. The values match the spec and fork:
    • timeout options 60 s, 5 min, 10 min, 1 h (default), 1 d, 1 w
    • reason at most 512 characters, nickname at most 32
    • ban: Permanent by default, 24 h history by default, "Custom…" starting at 60 s
    • roles highest first with int2rgb(0) = rgb(219,222,225)
  2. Interfaces: modals::{nickname,timeout,ban} exist. Confirm::{KickMember, RemoveTimeout, DeleteChannel, AnnouncementOff} are drawn by the generic confirm. Shift on "Duplicate channel" goes through core menus::with_shift. "Roles ▸" uses checkboxes that send MemberAction::ToggleRole and leave the menu and submenu open. "Community settings ▸" opens the chosen tab, and the row itself opens the first. No other task's interface is broken.
  3. Invariants: there is no new I/O in fluxer-ui, no secrets and no new fixtures. Menu lookups go through .get() or ?, so server data cannot panic the client. app.rs is untouched. Modal::ALL is extended consistently.
  4. Parity spot-checks against the fork:
    • GuildMemberContextMenu.tsx: the danger flags match (Transfer ownership, Timeout, Kick and Ban are red; Remove timeout is not), and so do the icons from ContextMenuIcons.tsx (Crown, Clock, Boot, Gavel, PencilSimple; Gear, Trash, CopySimple fill).
    • ManageRolesMenuItem: the sort, closeOnChange={false} and the disabled-when-unmanageable rule match.
    • BanMemberModal.tsx: the strings, the default state and Custom→MIN all match.
    • TimeoutMemberModal.tsx and TimeoutMemberOptions.ts: the strings and labels match.
    • KickMemberModal.tsx: the "Kick" button and its failure, "Something went wrong" / "Failed to kick member. Try again.", match.
    • ChannelMenuData.tsx:327: event.shiftKey duplicates at once.
  5. Review Focus: item 5 (menu rows) is Task 20's table tests. This task draws the store's rows in the store's order (menu_rows_drawn_in_core_order).

Findings

  • minor: confirm::admin_error titles every admin.error raised outside a settings screen "Something went wrong". That is right for kick, timeout removal and the role checkboxes. But admin::reorder also puts CATEGORY_FULL_TEXT in admin.error, and the original shows that with the title "Category full" (ChannelListContent.tsx:276-278, GenericErrorModal, title CATEGORY_FULL_DESCRIPTOR). Nothing reaches this path until Task 32 adds dragging, so no user sees it today. Task 32 should either reuse this alert with the "Category full" title (for example, use reorder::CATEGORY_FULL_TITLE when the error is CATEGORY_FULL_TEXT) or clear the error itself. Otherwise it gets the wrong title or two modals at once. This is a coordination note for Task 32, not a blocker here.
  • minor: without MANAGE_ROLES, "Roles ▸" shows a read-only list (MenuItemKind::Disabled). It is drawn as faded Item::Action rows with no colour dot. The original draws these rows unfaded and with the role's dot (readonlyRoleItem). This is a cosmetic parity gap only.
  • minor: the voice participant menu's moderation rows have no icons. This matches that menu's existing choice (none of its rows has an icon) but not the original. It is cosmetic.
  • minor: the ban modal's custom field is clamped on each keystroke into the value that is sent, while the text keeps the typed digits. That is the documented deviation and the sent value is right. Noted only.

Verdict: APPROVED. No blocking findings, and the local CI (with screenshots) is green.

## Independent review: Server admin 27 (ui-menus-moderation-modals) I reviewed `git diff 228bbd2e..origin/serveradmin-27-ui-menus-moderation-modals` at 978f902e. **Local gate:** I ran `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree. Result: "all steps passed", exit 0. ### Checks 1. **Tests the plan names:** all 8 headless tests are present (`menus_admin.rs`, `moderation_modals.rs`). All 11 goldens are in `screenshots.rs`, `fixtures/golden/` and `docs/screenshots/`. The values match the spec and fork: - timeout options 60 s, 5 min, 10 min, 1 h (default), 1 d, 1 w - reason at most 512 characters, nickname at most 32 - ban: Permanent by default, 24 h history by default, "Custom…" starting at 60 s - roles highest first with `int2rgb(0)` = rgb(219,222,225) 2. **Interfaces:** `modals::{nickname,timeout,ban}` exist. `Confirm::{KickMember, RemoveTimeout, DeleteChannel, AnnouncementOff}` are drawn by the generic confirm. Shift on "Duplicate channel" goes through core `menus::with_shift`. "Roles ▸" uses checkboxes that send `MemberAction::ToggleRole` and leave the menu and submenu open. "Community settings ▸" opens the chosen tab, and the row itself opens the first. No other task's interface is broken. 3. **Invariants:** there is no new I/O in fluxer-ui, no secrets and no new fixtures. Menu lookups go through `.get()` or `?`, so server data cannot panic the client. app.rs is untouched. `Modal::ALL` is extended consistently. 4. **Parity spot-checks against the fork:** - `GuildMemberContextMenu.tsx`: the danger flags match (Transfer ownership, Timeout, Kick and Ban are red; Remove timeout is not), and so do the icons from `ContextMenuIcons.tsx` (Crown, Clock, Boot, Gavel, PencilSimple; Gear, Trash, CopySimple fill). - `ManageRolesMenuItem`: the sort, `closeOnChange={false}` and the disabled-when-unmanageable rule match. - `BanMemberModal.tsx`: the strings, the default state and Custom→MIN all match. - `TimeoutMemberModal.tsx` and `TimeoutMemberOptions.ts`: the strings and labels match. - `KickMemberModal.tsx`: the "Kick" button and its failure, "Something went wrong" / "Failed to kick member. Try again.", match. - `ChannelMenuData.tsx:327`: `event.shiftKey` duplicates at once. 5. **Review Focus:** item 5 (menu rows) is Task 20's table tests. This task draws the store's rows in the store's order (`menu_rows_drawn_in_core_order`). ### Findings - **minor:** `confirm::admin_error` titles every `admin.error` raised outside a settings screen "Something went wrong". That is right for kick, timeout removal and the role checkboxes. But `admin::reorder` also puts `CATEGORY_FULL_TEXT` in `admin.error`, and the original shows that with the title "Category full" (`ChannelListContent.tsx:276-278`, `GenericErrorModal`, title `CATEGORY_FULL_DESCRIPTOR`). Nothing reaches this path until Task 32 adds dragging, so no user sees it today. Task 32 should either reuse this alert with the "Category full" title (for example, use `reorder::CATEGORY_FULL_TITLE` when the error is `CATEGORY_FULL_TEXT`) or clear the error itself. Otherwise it gets the wrong title or two modals at once. This is a coordination note for Task 32, not a blocker here. - **minor:** without MANAGE_ROLES, "Roles ▸" shows a read-only list (`MenuItemKind::Disabled`). It is drawn as faded `Item::Action` rows with no colour dot. The original draws these rows unfaded and with the role's dot (`readonlyRoleItem`). This is a cosmetic parity gap only. - **minor:** the voice participant menu's moderation rows have no icons. This matches that menu's existing choice (none of its rows has an icon) but not the original. It is cosmetic. - **minor:** the ban modal's custom field is clamped on each keystroke into the value that is sent, while the text keeps the typed digits. That is the documented deviation and the sent value is right. Noted only. **Verdict: APPROVED.** No blocking findings, and the local CI (with screenshots) is green.
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 09:07:13 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.