Also email room subscribers on the first unread message, not just mentions (#67)

The previous pass only emailed on a mention. Corrected scope: the
room's first unread message triggers one debounced email (same shape
as #66), and every mention additionally emails regardless of that
debounce, since a mention shouldn't get silently absorbed by an
earlier plain message's already-sent notification.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-28 19:51:02 -06:00
co-authored by Claude Sonnet 5
parent 250bb862f6
commit 278f8bb995
7 changed files with 120 additions and 68 deletions
+4 -3
View File
@@ -68,9 +68,10 @@ export function hideDm(roomId: string): Promise<void> {
return apiFetch<void>(`/api/rooms/${roomId}/hide`, { method: 'POST' })
}
// #67: per-viewer opt-in for email-on-mention in this room. 400s for a DM
// (backend rejects it -- see set_room_email_notifications), so callers
// should only expose the toggle for a non-DM room.
// #67: per-viewer opt-in for email on this room's first unread message
// and every mention. 400s for a DM (backend rejects it -- see
// set_room_email_notifications), so callers should only expose the
// toggle for a non-DM room.
export function updateRoomNotifications(roomId: string, emailNotifications: boolean): Promise<void> {
return apiFetch<void>(`/api/rooms/${roomId}/notifications`, {
method: 'PATCH',
+2 -2
View File
@@ -398,8 +398,8 @@ export function RoomInfoPanel({
<div className="room-info-section">
<div className="toggle-row">
<div className="toggle-label">
<span className="t">Email me on mentions</span>
<span className="d">Sent only while you're offline</span>
<span className="t">Email notifications</span>
<span className="d">New messages and mentions, while you're offline</span>
</div>
<label className="switch">
<input
+3 -2
View File
@@ -87,8 +87,9 @@ export interface MyRoomItem extends Room {
// #52: the other participant, only for is_dm rooms -- see backend
// schemas/room.py's MyRoomItem for why this is precomputed server-side.
dm_partner: DmPartnerInfo | null
// #67: this viewer's own opt-in for "email me when mentioned here while
// offline" -- always false for a DM (see backend's message_events.py).
// #67: this viewer's own opt-in for email while offline -- the room's
// first unread message plus every mention (see backend's
// message_events.py). Always false for a DM.
email_notifications: boolean
}