feat(mentions): @here/@channel politeness gate (LC-476) #464
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/LC-476-broadcast-mention-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Add the politeness gate for
@here/@channel(LC-476). The broadcast mentions themselves already worked end to end (resolve on send, write rows, fan outMentionedover WS/push/email, respect mute) - the only missing piece was controlling who may use them, to curb abuse.How
rooms.broadcast_allowed_for(migration 0069):all(default, preserves today's behavior) /moderators_only/admins_only, mirroringposting_allowed_for. Read on demand via a getter (not carried on theRoomstruct), likeretention_days.resolve_tokens_for_roomdrops@here/@channelto plain text when the author's effective room role doesn't satisfy the policy. Covers send, edit, and every reconcile path. Synthetic actors (webhook / email / bridge) bypass - they're operator/owner-configured, not a member abuse vector.POST /room/{id}/broadcast-policyreuses the posting-policy handler shape (samerequire_can_managegate,mod_actionsaudit, htmx-fragment / redirect dual response). i18n in en + es.Tests
New gate tests in
routes_broadcast_mentions.rs:admins_onlydrops a plain member's@channel(zero rows) while the admin still broadcasts; defaultalllets a member broadcast.just check,just test,just test-saasall green (ran check last).Notes
allmeans no behavior change on upgrade - existing rooms keep open broadcast until an admin restricts them. Additive migration, no operator action.Verify
just verifybuilds the release binary clean; boot fails only on the missing SSO env (environmental, as in prior PRs).Per-room politeness gate for @here / @channel. Migration 0069 adds the column (default 'all', CHECK in {all, moderators_only, admins_only}); get/set accessors mirror the retention/posting-policy pattern and read on demand rather than riding the Room struct. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>A "Broadcast mentions" card on the room Manage page (next to Posting policy) flips the gate between Everyone / Moderators only / Admins only. POST /room/{id}/broadcast-policy mirrors the posting-policy handler: same require_can_manage gate, mod_actions audit row, and htmx-fragment / redirect dual response. i18n in en + es. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>