Show mentioned badges & enable scrolling to mentions in conversations

This commit is contained in:
trevor-signal 2023-05-23 17:59:07 -04:00 committed by GitHub
parent caaeda8abe
commit d012779e87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 694 additions and 184 deletions

View file

@ -2575,6 +2575,14 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
);
}
const ourPNI = window.textsecure.storage.user.getCheckedUuid(
UUIDKind.PNI
);
const ourUuids: Set<string> = new Set([
ourACI.toString(),
ourPNI.toString(),
]);
message.set({
id: messageId,
attachments: dataMessage.attachments,
@ -2590,6 +2598,12 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
hasFileAttachments: dataMessage.hasFileAttachments,
hasVisualMediaAttachments: dataMessage.hasVisualMediaAttachments,
isViewOnce: Boolean(dataMessage.isViewOnce),
mentionsMe: (dataMessage.bodyRanges ?? []).some(bodyRange => {
if (!BodyRange.isMention(bodyRange)) {
return false;
}
return ourUuids.has(bodyRange.mentionUuid);
}),
preview,
requiredProtocolVersion:
dataMessage.requiredProtocolVersion ||