Add per-room opt-in email notifications on mention (#67)

Lets a member subscribe to email when they're @mentioned in a room
while offline, alongside #66's always-on DM email. Debounced the same
way #66 is (one email per unread burst, not one per mention), and
deliberately scoped to regular rooms only -- DMs already have #66's
automatic offline email with no separate toggle needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-08-28 19:45:04 -06:00
1 parent 3dabf0022c
commit 250bb862f6
10 files changed
+441 -6

No files matched your search

+10
View File
@@ -68,6 +68,16 @@ 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.
export function updateRoomNotifications(roomId: string, emailNotifications: boolean): Promise<void> {
return apiFetch<void>(`/api/rooms/${roomId}/notifications`, {
method: 'PATCH',
body: JSON.stringify({ email_notifications: emailNotifications }),
})
}
export function listRoomMembers(roomId: string): Promise<RoomMember[]> {
return apiFetch<RoomMember[]>(`/api/rooms/${roomId}/members`)
}