mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 00:07:56 +01:00
Treat replies similarly to mentions for notifications
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -613,7 +613,7 @@ export function CallManager({
|
||||
activeProfile: activeNotificationProfile,
|
||||
conversationId: ringingCallId,
|
||||
isCall: true,
|
||||
isMention: false,
|
||||
isMentionOrReply: false,
|
||||
})
|
||||
) {
|
||||
const redactedId = redactNotificationProfileId(
|
||||
@@ -727,7 +727,7 @@ export function CallManager({
|
||||
if (
|
||||
!shouldNotify({
|
||||
isCall: true,
|
||||
isMention: false,
|
||||
isMentionOrReply: false,
|
||||
conversationId: ringingCall.conversation.id,
|
||||
activeProfile: activeNotificationProfile,
|
||||
})
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '../messageModifiers/Polls.preload.js';
|
||||
import { shouldStoryReplyNotifyUser } from '../util/shouldStoryReplyNotifyUser.preload.js';
|
||||
import { ReactionSource } from '../reactions/ReactionSource.std.js';
|
||||
import { itemStorage } from '../textsecure/Storage.preload.js';
|
||||
|
||||
const log = createLogger('maybeNotify');
|
||||
|
||||
@@ -44,11 +45,21 @@ type MaybeNotifyArgs = {
|
||||
}
|
||||
);
|
||||
|
||||
function isMention(args: MaybeNotifyArgs): boolean {
|
||||
function isMentionOrReply(args: MaybeNotifyArgs): boolean {
|
||||
if ('reaction' in args || 'pollVote' in args) {
|
||||
return false;
|
||||
}
|
||||
return Boolean(args.message.mentionsMe);
|
||||
|
||||
if (args.message.mentionsMe) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const quoteAuthorAci = args.message.quote?.authorAci;
|
||||
if (quoteAuthorAci && itemStorage.user.isOurServiceId(quoteAuthorAci)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function maybeNotify(args: MaybeNotifyArgs): Promise<void> {
|
||||
@@ -95,7 +106,7 @@ export async function maybeNotify(args: MaybeNotifyArgs): Promise<void> {
|
||||
activeProfile,
|
||||
conversationId: conversation.id,
|
||||
isCall: false,
|
||||
isMention: isMention(args),
|
||||
isMentionOrReply: isMentionOrReply(args),
|
||||
})
|
||||
) {
|
||||
log.info('Would notify for message, but notification profile prevented it');
|
||||
@@ -220,5 +231,5 @@ function isAllowedByConversation(args: MaybeNotifyArgs): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isMention(args);
|
||||
return isMentionOrReply(args);
|
||||
}
|
||||
|
||||
@@ -97,12 +97,12 @@ export const NOTIFICATION_PROFILE_ID_LENGTH = 16;
|
||||
|
||||
export function shouldNotify({
|
||||
isCall,
|
||||
isMention,
|
||||
isMentionOrReply,
|
||||
conversationId,
|
||||
activeProfile,
|
||||
}: {
|
||||
isCall: boolean;
|
||||
isMention: boolean;
|
||||
isMentionOrReply: boolean;
|
||||
conversationId: string;
|
||||
activeProfile: NotificationProfileType | undefined;
|
||||
}): boolean {
|
||||
@@ -114,7 +114,7 @@ export function shouldNotify({
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isMention && activeProfile.allowAllMentions) {
|
||||
if (isMentionOrReply && activeProfile.allowAllMentions) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user