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

@ -16,6 +16,7 @@ import { queueAttachmentDownloads } from '../util/queueAttachmentDownloads';
import * as log from '../logging/log';
import { GiftBadgeStates } from '../components/conversation/Message';
import { queueUpdateMessage } from '../util/messageBatcher';
import { getMessageSentTimestamp } from '../util/getMessageSentTimestamp';
export type ViewSyncAttributesType = {
senderId: string;
@ -44,17 +45,18 @@ export class ViewSyncs extends Collection {
uuid: message.get('sourceUuid'),
reason: 'ViewSyncs.forMessage',
});
const messageTimestamp = getMessageSentTimestamp(message.attributes, {
log,
});
const syncs = this.filter(item => {
return (
item.get('senderId') === sender?.id &&
item.get('timestamp') === message.get('sent_at')
item.get('timestamp') === messageTimestamp
);
});
if (syncs.length) {
log.info(
`Found ${syncs.length} early view sync(s) for message ${message.get(
'sent_at'
)}`
`Found ${syncs.length} early view sync(s) for message ${messageTimestamp}`
);
this.remove(syncs);
}