From f1394afee5b27a37d793f7ab515cf418060a9f99 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Mon, 23 Feb 2026 12:06:56 -0600 Subject: [PATCH] Treat replies similarly to mentions for notifications Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com> --- ts/components/CallManager.dom.tsx | 4 ++-- ts/messages/maybeNotify.preload.ts | 19 +++++++++++++++---- ts/types/NotificationProfile.std.ts | 6 +++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ts/components/CallManager.dom.tsx b/ts/components/CallManager.dom.tsx index ceda9fcfc3..9e1f19c548 100644 --- a/ts/components/CallManager.dom.tsx +++ b/ts/components/CallManager.dom.tsx @@ -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, }) diff --git a/ts/messages/maybeNotify.preload.ts b/ts/messages/maybeNotify.preload.ts index 99111bef2c..c4cbdc9621 100644 --- a/ts/messages/maybeNotify.preload.ts +++ b/ts/messages/maybeNotify.preload.ts @@ -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 { @@ -95,7 +106,7 @@ export async function maybeNotify(args: MaybeNotifyArgs): Promise { 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); } diff --git a/ts/types/NotificationProfile.std.ts b/ts/types/NotificationProfile.std.ts index a0957ad230..611d584815 100644 --- a/ts/types/NotificationProfile.std.ts +++ b/ts/types/NotificationProfile.std.ts @@ -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; }