feat/dm-mute #60

Merged
longjacksonle merged 8 commits from feat/dm-mute into main 2026-05-10 04:50:36 +02:00
No description provided.
Introduce `set_dm_mute` for toggling mute on DM rooms (true writes `MuteMode::All`, false deletes the row). Add a shared `assert_room_kind` helper that prevents `set_room_mute_mode` from being called on DM rooms and `set_dm_mute` from being called on non-DM rooms, returning `sqlx::Error::Protocol` on mismatch so callers can surface a 400.

Cover all cases in a new `db_dm_mute` integration test suite: mute/unmute idempotency, per-user independence, cross-room isolation, and rejection of missing or wrong-kind rooms.
Unify DM and room mute handling by dropping the special-case `kind == "dm"` bypass in `push::dispatch` and the WS `Mentioned` arm. Both now consult `room_mute_mode` uniformly, so a muted DM room suppresses push and WS notification events the same way a muted channel does.

On the UI side, extract the DM header into a standalone `dm_header.html` partial backed by `DmHeaderFragment`, add a Mute checkbox that POSTs to `/dm/{peer_id}/mute` and swaps the header `outerHTML` in place, and pass the current `mute_mode` from the page handler into the template. The sidebar now reads `peer.mute_mode` instead of hardcoding `"none"`, so muted peers render in a greyed link style.

Add a `DmMuteChanged` WS event that triggers a sidebar OOB re-render across the muter's open tabs, and register it in `render_event` as a no-op fallback. Update tests: rename the old bypass test to confirm DM events are now dropped when muted, and add a complementary test confirming they fire when unmuted.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!60
No description provided.