fix(calls): incoming-call ringtone respects quiet hours, DND, Focus Assist and snooze
CI / Build & Quality Checks (push) Canceled after 11s
CI / Trigger Desktop Build (push) Canceled after 0s
CI / Secret scan (gitleaks) (push) Canceled after 0s
CI / Docker image build & smoke test (push) Canceled after 0s
CI / Playwright smoke (e2e) (push) Canceled after 0s

The "should we make noise" predicate used for message sounds is extracted
into useNotificationsQuiet() (unit-tested) and applied to the ringtone in
both the full-screen incoming-call overlay and the compact in-call banner.
The overlay/banner still show so the call can be answered; only the audio
is skipped. Join/media paths untouched.

Fixes #28

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-09-15 22:43:17 -04:00
co-authored by Claude Opus 5
parent 4cdd221eff
commit 3dead4b3e1
4 changed files with 130 additions and 42 deletions
+12 -4
View File
@@ -68,6 +68,7 @@ import { getPowersLevelFromMatrixEvent } from '../hooks/usePowerLevels';
import { getRoomCreatorsForRoomId } from '../hooks/useRoomCreators';
import { getRoomPermissionsAPI } from '../hooks/useRoomPermissions';
import { useLivekitSupport } from '../hooks/useLivekitSupport';
import { useNotificationsQuiet } from '../hooks/useNotificationsQuiet';
import { CallAvatarAnimation } from '../styles/Animations.css';
import { webRTCSupported } from '../utils/rtc';
import { zIndices } from '../styles/zIndex';
@@ -114,6 +115,10 @@ function IncomingCall({ dm, info, onIgnore, onAnswer, onReject }: IncomingCallPr
const [ringtoneVolume] = useSetting(settingsAtom, 'ringtoneVolume');
const [ringtoneId] = useSetting(settingsAtom, 'ringtoneId');
// Gitea #28 — don't ring during quiet hours / DND / Focus Assist / snooze. The
// call can still be answered from this overlay; only the audible ring is
// skipped.
const quiet = useNotificationsQuiet();
const roomName = useRoomName(room);
const roomAvatar = useRoomAvatar(room, dm);
@@ -135,10 +140,10 @@ function IncomingCall({ dm, info, onIgnore, onAnswer, onReject }: IncomingCallPr
);
useEffect(() => {
if (info.notificationType !== 'ring') return undefined;
if (info.notificationType !== 'ring' || quiet) return undefined;
const stop = startRingtone(ringtoneId, Math.max(0, Math.min(1, ringtoneVolume / 100)));
return stop;
}, [info.notificationType, ringtoneId, ringtoneVolume]);
}, [info.notificationType, ringtoneId, ringtoneVolume, quiet]);
useEffect(() => {
const remaining = info.senderTs + info.lifetime - Date.now();
@@ -275,6 +280,9 @@ function IncomingCallBanner({ dm, info, onIgnore, onAnswer, onReject }: Incoming
const [ringtoneVolume] = useSetting(settingsAtom, 'ringtoneVolume');
const [ringtoneId] = useSetting(settingsAtom, 'ringtoneId');
// Gitea #28 — no ping during quiet hours / DND / Focus Assist / snooze; the
// banner itself still shows so the call can be answered.
const quiet = useNotificationsQuiet();
const roomName = useRoomName(room);
const roomAvatar = useRoomAvatar(room, dm);
@@ -301,11 +309,11 @@ function IncomingCallBanner({ dm, info, onIgnore, onAnswer, onReject }: Incoming
// ringtone settings while the banner is showing.
const pingedRef = useRef<string | undefined>(undefined);
useEffect(() => {
if (info.notificationType !== 'ring') return;
if (info.notificationType !== 'ring' || quiet) return;
if (pingedRef.current === info.refEventId) return;
pingedRef.current = info.refEventId;
previewRingtone(ringtoneId, Math.max(0, Math.min(1, ringtoneVolume / 100)));
}, [info.notificationType, info.refEventId, ringtoneId, ringtoneVolume]);
}, [info.notificationType, info.refEventId, ringtoneId, ringtoneVolume, quiet]);
useEffect(() => {
const remaining = info.senderTs + info.lifetime - Date.now();