diff --git a/ts/state/selectors/message.ts b/ts/state/selectors/message.ts index 943f39efe..26de4c6a3 100644 --- a/ts/state/selectors/message.ts +++ b/ts/state/selectors/message.ts @@ -127,6 +127,7 @@ import { isSignalConversation } from '../../util/isSignalConversation'; import type { AnyPaymentEvent } from '../../types/Payment'; import { isPaymentNotificationEvent } from '../../types/Payment'; import { getTitleNoDefault, getNumber } from '../../util/getTitle'; +import { getMessageSentTimestamp } from '../../util/getMessageSentTimestamp'; export { isIncoming, isOutgoing, isStory }; @@ -762,7 +763,7 @@ export const getPropsForMessage = ( status: getMessagePropStatus(message, ourConversationId), text: message.body, textDirection: getTextDirection(message.body), - timestamp: message.sent_at, + timestamp: getMessageSentTimestamp(message, { includeEdits: true, log }), }; }; diff --git a/ts/test-mock/messaging/edit_test.ts b/ts/test-mock/messaging/edit_test.ts index 8375b0e41..50bc77e96 100644 --- a/ts/test-mock/messaging/edit_test.ts +++ b/ts/test-mock/messaging/edit_test.ts @@ -275,7 +275,10 @@ describe('editing', function needsName() { assert.strictEqual(firstEdit.dataMessage?.body, 'edit message 2'); debug('opening context menu again'); - await message.locator('[aria-label="More actions"]').click(); + const firstEditMessage = window.locator( + `.module-message[data-testid="${firstEdit.dataMessage?.timestamp?.toNumber()}"]` + ); + await firstEditMessage.locator('[aria-label="More actions"]').click(); debug('starting second message edit'); await window.locator('.module-message__context__edit-message').click(); @@ -295,7 +298,12 @@ describe('editing', function needsName() { assert.strictEqual(secondEdit.dataMessage?.body, 'edit message 3'); debug('opening edit history'); - await message.locator('.module-message__metadata__edited').click(); + const secondEditMessage = window.locator( + `.module-message[data-testid="${secondEdit.dataMessage?.timestamp?.toNumber()}"]` + ); + await secondEditMessage + .locator('.module-message__metadata__edited') + .click(); const history = await window.locator( '.EditHistoryMessagesModal .module-message'