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

@ -30,6 +30,7 @@ import { isSignalConversation } from './isSignalConversation';
import { strictAssert } from './assert';
import { timeAndLogIfTooLong } from './timeAndLogIfTooLong';
import { makeQuote } from './makeQuote';
import { getMessageSentTimestamp } from './getMessageSentTimestamp';
const SEND_REPORT_THRESHOLD_MS = 25;
@ -82,9 +83,12 @@ export async function sendEditedMessage(
}
const timestamp = Date.now();
const targetSentTimestamp =
targetMessage.attributes.editMessageTimestamp ??
targetMessage.attributes.timestamp;
const targetSentTimestamp = getMessageSentTimestamp(
targetMessage.attributes,
{
log,
}
);
log.info(`${idLog}: edited(${timestamp}) original(${targetSentTimestamp})`);