mentionsMe check: normalize before comparing against our UUID
This commit is contained in:
parent
b79cb5d160
commit
17eb0948ea
2 changed files with 25 additions and 4 deletions
|
@ -5535,10 +5535,25 @@ export class ConversationModel extends window.Backbone
|
|||
return;
|
||||
}
|
||||
|
||||
const ourUuid = window.textsecure.storage.user.getUuid()?.toString();
|
||||
const mentionsMe = (message.get('bodyRanges') || []).some(
|
||||
range => BodyRange.isMention(range) && range.mentionUuid === ourUuid
|
||||
const ourACI = window.textsecure.storage.user.getCheckedUuid(
|
||||
UUIDKind.ACI
|
||||
);
|
||||
const ourPNI = window.textsecure.storage.user.getCheckedUuid(
|
||||
UUIDKind.PNI
|
||||
);
|
||||
const ourUuids: Set<string> = new Set([
|
||||
ourACI.toString(),
|
||||
ourPNI.toString(),
|
||||
]);
|
||||
|
||||
const mentionsMe = (message.get('bodyRanges') || []).some(bodyRange => {
|
||||
if (!BodyRange.isMention(bodyRange)) {
|
||||
return false;
|
||||
}
|
||||
return ourUuids.has(
|
||||
normalizeUuid(bodyRange.mentionUuid, 'notify: mentionsMe check')
|
||||
);
|
||||
});
|
||||
if (!mentionsMe) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -188,6 +188,7 @@ import {
|
|||
queueUpdateMessage,
|
||||
saveNewMessageBatcher,
|
||||
} from '../util/messageBatcher';
|
||||
import { normalizeUuid } from '../util/normalizeUuid';
|
||||
|
||||
/* eslint-disable more/no-then */
|
||||
|
||||
|
@ -2609,7 +2610,12 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
|||
if (!BodyRange.isMention(bodyRange)) {
|
||||
return false;
|
||||
}
|
||||
return ourUuids.has(bodyRange.mentionUuid);
|
||||
return ourUuids.has(
|
||||
normalizeUuid(
|
||||
bodyRange.mentionUuid,
|
||||
'handleDataMessage: mentionsMe check'
|
||||
)
|
||||
);
|
||||
}),
|
||||
preview,
|
||||
requiredProtocolVersion:
|
||||
|
|
Loading…
Reference in a new issue