From 70bdbe33d5eeba7f4992152004e680ad594117fe Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Fri, 19 Aug 2022 17:12:05 -0400 Subject: [PATCH] Group stories should have a different timestamp --- ts/jobs/helpers/sendStory.ts | 2 +- ts/util/sendStoryMessage.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ts/jobs/helpers/sendStory.ts b/ts/jobs/helpers/sendStory.ts index dc27d34c81..f7c91fc42d 100644 --- a/ts/jobs/helpers/sendStory.ts +++ b/ts/jobs/helpers/sendStory.ts @@ -310,7 +310,7 @@ export async function sendStory( sendOptions, sendTarget, sendType: 'story', - timestamp, + timestamp: message.get('timestamp'), urgent: false, }); diff --git a/ts/util/sendStoryMessage.ts b/ts/util/sendStoryMessage.ts index f41ab2ded3..df746a0e25 100644 --- a/ts/util/sendStoryMessage.ts +++ b/ts/util/sendStoryMessage.ts @@ -170,7 +170,7 @@ export async function sendStoryMessage( >(); await Promise.all( - conversationIds.map(async conversationId => { + conversationIds.map(async (conversationId, index) => { const group = window.ConversationController.get(conversationId); if (!group) { @@ -189,10 +189,12 @@ export async function sendStoryMessage( return; } + const groupTimestamp = timestamp + index; + const myId = window.ConversationController.getOurConversationIdOrThrow(); const sendState = { status: SendStatus.Pending, - updatedAt: timestamp, + updatedAt: groupTimestamp, }; const sendStateByConversationId = getRecipients(group.attributes).reduce( @@ -220,13 +222,13 @@ export async function sendStoryMessage( id: UUID.generate().toString(), readStatus: ReadStatus.Read, received_at: incrementMessageCounter(), - received_at_ms: timestamp, + received_at_ms: groupTimestamp, seenStatus: SeenStatus.NotApplicable, sendStateByConversationId, - sent_at: timestamp, + sent_at: groupTimestamp, source: window.textsecure.storage.user.getNumber(), sourceUuid: window.textsecure.storage.user.getUuid()?.toString(), - timestamp, + timestamp: groupTimestamp, type: 'story', });