Use correct timestamp for receipts of edited messages

This commit is contained in:
Fedor Indutny 2023-05-16 10:37:12 -07:00 committed by GitHub
parent 8fe0047822
commit 5869717cd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 156 additions and 52 deletions

View file

@ -10,6 +10,7 @@ import * as log from '../logging/log';
import * as Errors from '../types/errors';
import { deleteForEveryone } from '../util/deleteForEveryone';
import { drop } from '../util/drop';
import { getMessageSentTimestampSet } from '../util/getMessageSentTimestampSet';
export type DeleteAttributesType = {
targetSentTimestamp: number;
@ -31,10 +32,11 @@ export class Deletes extends Collection<DeleteModel> {
}
forMessage(message: MessageModel): Array<DeleteModel> {
const sentTimestamps = getMessageSentTimestampSet(message.attributes);
const matchingDeletes = this.filter(item => {
return (
item.get('targetSentTimestamp') === message.get('sent_at') &&
item.get('fromId') === getContactId(message.attributes)
item.get('fromId') === getContactId(message.attributes) &&
sentTimestamps.has(item.get('targetSentTimestamp'))
);
});