Skip to content

Commit

Permalink
fix: do not mute alerts if busy, only mute sounds, fixes #147
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Nov 25, 2024
1 parent cae12ad commit 16c6dbf
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/broker/delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,14 @@ class BrokerDelegate implements ProseClientDelegate {
selfAvailability = Store.$account.getInformationAvailability();

// Check if user can be notified
// Notice: user cannot be notified if:
// - #1. User has paused notifications
// - #2. User is in 'Available' availability mode (DND and Invisible \
// should both mute alerts)
const hasNotifications =
(Store.$settings.notifications.pause.until || 0) <= Date.now() &&
selfAvailability === Availability.Available;
(Store.$settings.notifications.pause.until || 0) <= Date.now();

// Play incoming message sound? (check if sounds are allowed or not)
// Notice: do not play if user is in DND mode (should mute audible alerts)
if (
hasNotifications === true &&
selfAvailability !== Availability.DoNotDisturb &&
Store.$settings.notifications.action.notify.sound === true
) {
const firstNonSelfMessage = messages.find(message => {
Expand Down

0 comments on commit 16c6dbf

Please sign in to comment.