Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

Beside a live mute or ban on /admin, an Unmute or Unban button lifts it, same-origin, and the lift is logged #320

Parked opened this
Closed without merging

The Moderation section on /admin now lists every mute and ban in force, each with an Unmute or Unban button. The new test and the related admin, lobby, accounts and chat suites pass.

Notes

stopped parked by the crew deploy 876f712

opened this

The Moderation section on /admin now lists every mute and ban in force, each with an Unmute or Unban button. The new test and the related admin, lobby, accounts and chat suites pass. I couldn't run the type check: bun install and bun x tsc fail in this sandbox with "unable to write files to tempdir", so the forge's check is the first type check.

  • No list existed to build on. /admin only showed the log, so I added the list of live mutes and bans as well as the buttons.
  • Button action. Each button posts a form with the unmute or unban action to the existing /admin handler in src/admin-routes.ts. The handler lifts the mute or ban and logs it as unmuted <name> or unbanned <name>, credited to whoever pressed the button.
  • Who can lift. The owner and verified moderators can lift mutes and bans. A moderator can't lift another moderator's mute, which matches the live mute rule. Every other action stays owner-only, so a moderator posting pause still gets 403.
  • Origin check. The same-origin check in the relay already covers every non-GET request, so a cross-origin POST gets 403 with no new code.
  • Lobby changes. In src/lobby.ts I added liftMute, liftBan and afterBanChange. The /live unban now uses them too, so both routes lift and log the same way and notify connected viewers.
  • Tests. The new test is in src/admin-relay.test.ts. A moderator's unban and unmute work and appear in the log, and a cross-origin POST is refused with 403 and changes nothing.

Differs from the issue: a plain user's POST gets 404, not 403. /admin deliberately doesn't exist for anyone who isn't the owner or a verified moderator, and an existing test pins that, so I kept it. A moderator's disallowed POST does get 403.

forge.json is untouched.

🤖 Generated with Claude Code

Closes #221

commented

The Moderation section on /admin now lists every mute and ban in force, each with an Unmute or Unban button. The new test and the related admin, lobby, accounts and chat suites pass. I couldn't run the type check: bun install and bun x tsc fail in this sandbox with "unable to write files to tempdir", so the forge's check is the first type check.

  • No list existed to build on. /admin only showed the log, so I added the list of live mutes and bans as well as the buttons.
  • Button action. Each button posts a form with the unmute or unban action to the existing /admin handler in src/admin-routes.ts. The handler lifts the mute or ban and logs it as unmuted <name> or unbanned <name>, credited to whoever pressed the button.
  • Who can lift. The owner and verified moderators can lift mutes and bans. A moderator can't lift another moderator's mute, which matches the live mute rule. Every other action stays owner-only, so a moderator posting pause still gets 403.
  • Origin check. The same-origin check in the relay already covers every non-GET request, so a cross-origin POST gets 403 with no new code.
  • Lobby changes. In src/lobby.ts I added liftMute, liftBan and afterBanChange. The /live unban now uses them too, so both routes lift and log the same way and notify connected viewers.
  • Tests. The new test is in src/admin-relay.test.ts. A moderator's unban and unmute work and appear in the log, and a cross-origin POST is refused with 403 and changes nothing.

Differs from the issue: a plain user's POST gets 404, not 403. /admin deliberately doesn't exist for anyone who isn't the owner or a verified moderator, and an existing test pins that, so I kept it. A moderator's disallowed POST does get 403.

forge.json is untouched.

🤖 Generated with Claude Code

commented

Parked by the crew: the preview's deploy failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs