Don't show "group call started" notifications for muted conversations

This commit is contained in:
Evan Hahn 2021-09-29 15:29:40 -05:00 committed by GitHub
parent 603c315c82
commit fc066e05df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2034,6 +2034,11 @@ export class CallingClass {
conversationId: string, conversationId: string,
creatorBytes: undefined | Readonly<Uint8Array> creatorBytes: undefined | Readonly<Uint8Array>
): void { ): void {
const conversation = window.ConversationController.get(conversationId);
if (conversation?.isMuted()) {
return;
}
const creatorUuid = creatorBytes ? bytesToUuid(creatorBytes) : undefined; const creatorUuid = creatorBytes ? bytesToUuid(creatorBytes) : undefined;
const creatorConversation = window.ConversationController.get(creatorUuid); const creatorConversation = window.ConversationController.get(creatorUuid);
if (creatorConversation && isMe(creatorConversation.attributes)) { if (creatorConversation && isMe(creatorConversation.attributes)) {
@ -2052,8 +2057,7 @@ export class CallingClass {
'calling__call-notification__started-by-someone' 'calling__call-notification__started-by-someone'
); );
break; break;
default: { default:
const conversation = window.ConversationController.get(conversationId);
// These fallbacks exist just in case something unexpected goes wrong. // These fallbacks exist just in case something unexpected goes wrong.
notificationTitle = notificationTitle =
conversation?.getTitle() || FALLBACK_NOTIFICATION_TITLE; conversation?.getTitle() || FALLBACK_NOTIFICATION_TITLE;
@ -2063,7 +2067,6 @@ export class CallingClass {
]) ])
: window.i18n('calling__call-notification__started-by-someone'); : window.i18n('calling__call-notification__started-by-someone');
break; break;
}
} }
notificationService.notify({ notificationService.notify({