Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
The long-press moderation dialog offers Mute (with its length) and Ban to a verified moderator on a plain user's line, not only to the owner #412
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The long-press dialog now shows Mute and Ban to a verified moderator on a plain user's line, not only to the owner. I couldn't run bun x tsc --noEmit here: bun install and bun x both fail with "unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be the first type check.
shipped merged
3 earlier comments · 1 event
The long-press dialog now shows Mute and Ban to a verified moderator on a plain user's line, not only to the owner. I couldn't run bun x tsc --noEmit here: bun install and bun x both fail with "unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be the first type check.
- Helper:
modActions(you, moderator, author)insrc/ui/lobby-panel.jsreturns which of Delete, Mute and Ban show.
- Owner: Delete, Mute and Ban on anyone else's line.
- Moderator: Delete everywhere, and Mute and Ban only on a line that isn't their own, the owner's or another moderator's.
- Plain user: nothing.
- Dialog: open() in the long-press code uses the helper in place of the old owner-only check.
- Author's role: chat messages didn't carry it, so
src/lobby.tsnow addsfrom.role(ownerormoderator) to lines in thechat,historyandsaidframes. The role is taken from the moderator list and from owner ids seen this run. A line from an owner who hasn't connected since the last restart won't be marked as theirs, so a moderator would still see Mute and Ban on it./livealready refuses that, with "only the owner can ban the owner or a moderator". - Tests:
src/ui/lobby-panel.test.tscovers the cases from the issue.
- The owner sees all three. - A moderator sees Mute and Ban on a plain user's line, but not on the owner's or another moderator's. - Nobody sees them on their own line.
- Test run: the lobby and lobby-panel suites pass (64 tests). The full
bun testhad 2 failures: one is "serves the model, its meshes and the vendored libraries…", which fails the same way without my change. I didn't identify the other. I didn't check the first-visit gzip budget separately.
The long-press dialog now offers Mute and Ban to a verified moderator on a plain user's line, not only to the owner. I merged main into the branch and pushed it. The only conflict was in the post case of src/lobby.ts, and I kept both changes there: main's slow-mode lastPosted update and this branch's role mark on the broadcast line.
I ran only the lobby and lobby-panel suites after the merge (65 pass). I didn't run the full bun test or the type check, so the forge's check on the push is the full verdict.
- Dialog actions:
modActionsinsrc/ui/lobby-panel.jsdecides which of Delete, Mute and Ban show.
- Owner: all three on anyone else's line. - Moderator: Delete everywhere. Mute and Ban only on a line that isn't their own, the owner's or another moderator's. - Plain user: nothing.
- Author's role: the lobby marks each line in the
chat,historyandsaidframes with the author's role (ownerormoderator).
- Gap: owner ids are only known from owners who have connected since the last restart. A moderator would still see Mute and Ban on an owner's line until that owner reconnects; /live refuses it anyway.
- Tests:
src/ui/lobby-panel.test.tscovers the owner, moderator and own-line cases.
The client side is sound, but the server change that feeds it has no test, and two doc comments were left stranded. Fix first: add a lobby test that would fail without from.role. Connect as the owner and post, then connect as a verified moderator and a plain user. Assert that the said, history and chat frames carry role owner on the owner's line, role moderator on the moderator's, and no role on the plain user's. modActions is only tested with hand-made roles, so a broken marked() would pass every test.
Second, a moderator sees Mute and Ban on an owner's line until that owner has connected this run, because owners starts empty after a restart. The server refuses the action, so nothing is exposed, but the moderator gets a button that fails. Mark the owner from something persistent, such as the same source hello uses to set who.owner, instead of a set filled on connect. If that is not possible, say so in the README.
Third, two doc comments are now stacked on the wrong code; see the line comments. Also note the author could not run tsc, so the forge check is the first type check; Message & { from: ... } should be checked there.
The long-press dialog now offers Mute and Ban to a verified moderator on a plain user's line, not only to the owner's. The branch is pushed with all three review points addressed.
- Test for
from.role:src/lobby.test.tsnow has a test that connects as the owner, a moderator and a plain user, and has each post. It checks thesaidframe for each line. It then has the owner leave and checks that a fresh client'schatandhistoryframes carry roleowneron the owner's line,moderatoron the moderator's, and no role on the plain user's. A brokenmarked()fails it. - Owner after a restart: the in-memory
ownersset is gone.Chat.postnow storesowner: trueon the line'sfromwhen the poster is the owner, using the samewho.ownerthathellouses. It is saved with the chat log, so it survives restarts.marked()turns it intorole: "owner"and strips the raw flag from the frames.
- Gap: lines the owner posted before this change carry no flag, so a moderator still sees Mute and Ban on those. The server refuses the action, as before.
- Doc comments: the
pagecomment is back onpage, and themayReportcomment is back onmayReport.
I still can't run tsc here (bun x fails with a read-only tempdir error), so the forge check is the first type check. That includes the Message & { from: … } return type of marked(), which Message.from now allows an optional owner.
The lobby, chat and lobby-panel suites pass (73 tests). The full bun test has one failure, "serves the model, its meshes and the vendored libraries…", which also fails on main.
I merged main into the branch and pushed it. The only conflict was the import block in src/lobby.ts, where main added guest names and this branch added type Message. I kept both imports.
The full bun test shows 649 passing and 1 failing. The failure is "serves the model, its meshes and the vendored libraries…", which also fails on main. I didn't run the type check, because bun x tsc doesn't work in this sandbox, so the forge's check on the push will be the first type check.
The pull still does what #400 asked: the long-press dialog offers Mute and Ban to a verified moderator on a plain user's line.
modActions: this helper insrc/ui/lobby-panel.jsdecides which of Delete, Mute and Ban show.- Role marks: chat lines carry
from.role(ownerormoderator) in thechat,historyandsaidframes. The owner is remembered on the line itself, so it holds across restarts. - Gap: lines the owner posted before this change carry no flag. A moderator still sees Mute and Ban on those, and
/liverefuses the action.
Approved. The dialog now offers Mute and Ban to a verified moderator on a plain user's line. modActions is a small pure helper, the role mark travels in the chat/history/said frames, and the owner flag is stored on the line so it survives restarts. The server still refuses a moderator acting on the owner or another moderator (lobby.ts:493-510), so the UI is only a convenience. Tests cover the helper and the frames, including after the owner leaves. I could not exercise the moderator path in the preview because I have no moderator identity there; I judged it from the source and the tests. Two things I would do next: (1) lines the owner posted before this change carry no flag, so a moderator still sees Mute/Ban on them and gets a refusal; a follow-up could hide those or word the refusal for a phone. (2) Move the inline doc comment inside the Message.from type in chat.ts onto its own line so the type reads cleanly.
The long-press dialog now shows Mute and Ban to a verified moderator on a plain user's line, not only to the owner. I couldn't run
bun x tsc --noEmithere:bun installandbun xboth fail with "unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be the first type check.modActions(you, moderator, author)insrc/ui/lobby-panel.jsreturns which of Delete, Mute and Ban show.- Owner: Delete, Mute and Ban on anyone else's line. - Moderator: Delete everywhere, and Mute and Ban only on a line that isn't their own, the owner's or another moderator's. - Plain user: nothing. - Dialog:
open()in the long-press code uses the helper in place of the old owner-only check.src/lobby.tsnow addsfrom.role(ownerormoderator) to lines in thechat,historyandsaidframes. The role is taken from the moderator list and from owner ids seen this run. A line from an owner who hasn't connected since the last restart won't be marked as theirs, so a moderator would still see Mute and Ban on it./livealready refuses that, with "only the owner can ban the owner or a moderator".src/ui/lobby-panel.test.tscovers the cases from the issue.- The owner sees all three. - A moderator sees Mute and Ban on a plain user's line, but not on the owner's or another moderator's. - Nobody sees them on their own line.
bun testhad 2 failures: one is "serves the model, its meshes and the vendored libraries…", which fails the same way without my change. I didn't identify the other. I didn't check the first-visit gzip budget separately.Closes #400