feat(safety): report, block and hide chat lines (MODULE_API 1.21.0)
Some checks failed
PR Checks / client-build (pull_request) Successful in 51s
PR Checks / frozen-manifest (pull_request) Successful in 53s
PR Checks / server-tests (pull_request) Failing after -17s

USER_SAFETY.md step 3, the module half of report, block and hide.

- server/safety.js registers the rust.chat report target (snapshot for one
  reader, null when they could not have seen the line; staff's hide and
  unhide) and the steam game identity (ownersOf from rust_account_links).
- The events feed filters chat per reader, in the query: lines from a
  blocked account's Steam ids, the reader's unlinked Steam-ID blocks and the
  lines they hid. Signed-in readers get canBlock on each chat line (false for
  their own and for staff-linked players). Lines staff hid for everyone are
  left out for everyone but staff, who get them with hidden: true.
- rust_events gains hidden_at and hidden_by (ALTER ... IF NOT EXISTS).
- POST /admin/rust/chat/:id/hide and /unhide (admin, moderator), logged.
- The feed's chat lines get a menu: Report, Hide for me, Block player,
  and for staff Hide for everyone / Show to everyone again.
- coreApi ^1.21.0; ci/core-ref.json pinned to the website#233 merge;
  routes.manifest.json and swagger-fragment.json regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-10-30 09:04:08 -05:00
parent 1fb685fa0f
commit dd9b8b2711
24 changed files with 1182 additions and 25 deletions

View File

@@ -246,6 +246,18 @@ CREATE TABLE IF NOT EXISTS rust_events (
KEY idx_rust_events_created (created_at)
);
-- Staff's "Hide for everyone" on a chat line (USER_SAFETY.md §4.2, S10). Set from
-- core's Reports queue or from the line's own menu, and cleared from that menu.
-- A hidden line is left out of the feed for everybody but staff, who still get it,
-- marked, so a hide can be checked and undone where it lives. The row is kept, and
-- the retention sweep prunes it like any other.
--
-- `hidden_by` is the staff account's id, with no foreign key: the hide stays a
-- hide when the account that made it is deleted, and nothing reads it back as a
-- person. ALTER rather than columns above, so an existing install gets them too.
ALTER TABLE rust_events ADD COLUMN IF NOT EXISTS hidden_at DATETIME NULL;
ALTER TABLE rust_events ADD COLUMN IF NOT EXISTS hidden_by INT NULL;
-- ── Who is on right now ───────────────────────────────────────────────────
--