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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ourUuid = window.textsecure.storage.user.getUuid()?.toString();
|
const ourACI = window.textsecure.storage.user.getCheckedUuid(
|
||||||
const mentionsMe = (message.get('bodyRanges') || []).some(
|
UUIDKind.ACI
|
||||||
range => BodyRange.isMention(range) && range.mentionUuid === ourUuid
|
|
||||||
);
|
);
|
||||||
|
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) {
|
if (!mentionsMe) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,7 @@ import {
|
||||||
queueUpdateMessage,
|
queueUpdateMessage,
|
||||||
saveNewMessageBatcher,
|
saveNewMessageBatcher,
|
||||||
} from '../util/messageBatcher';
|
} from '../util/messageBatcher';
|
||||||
|
import { normalizeUuid } from '../util/normalizeUuid';
|
||||||
|
|
||||||
/* eslint-disable more/no-then */
|
/* eslint-disable more/no-then */
|
||||||
|
|
||||||
|
@ -2609,7 +2610,12 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
if (!BodyRange.isMention(bodyRange)) {
|
if (!BodyRange.isMention(bodyRange)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return ourUuids.has(bodyRange.mentionUuid);
|
return ourUuids.has(
|
||||||
|
normalizeUuid(
|
||||||
|
bodyRange.mentionUuid,
|
||||||
|
'handleDataMessage: mentionsMe check'
|
||||||
|
)
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
preview,
|
preview,
|
||||||
requiredProtocolVersion:
|
requiredProtocolVersion:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue