Group stories should have a different timestamp

This commit is contained in:
Josh Perez 2022-08-19 17:12:05 -04:00 committed by GitHub
parent f7f65de322
commit 70bdbe33d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -310,7 +310,7 @@ export async function sendStory(
sendOptions, sendOptions,
sendTarget, sendTarget,
sendType: 'story', sendType: 'story',
timestamp, timestamp: message.get('timestamp'),
urgent: false, urgent: false,
}); });

View file

@ -170,7 +170,7 @@ export async function sendStoryMessage(
>(); >();
await Promise.all( await Promise.all(
conversationIds.map(async conversationId => { conversationIds.map(async (conversationId, index) => {
const group = window.ConversationController.get(conversationId); const group = window.ConversationController.get(conversationId);
if (!group) { if (!group) {
@ -189,10 +189,12 @@ export async function sendStoryMessage(
return; return;
} }
const groupTimestamp = timestamp + index;
const myId = window.ConversationController.getOurConversationIdOrThrow(); const myId = window.ConversationController.getOurConversationIdOrThrow();
const sendState = { const sendState = {
status: SendStatus.Pending, status: SendStatus.Pending,
updatedAt: timestamp, updatedAt: groupTimestamp,
}; };
const sendStateByConversationId = getRecipients(group.attributes).reduce( const sendStateByConversationId = getRecipients(group.attributes).reduce(
@ -220,13 +222,13 @@ export async function sendStoryMessage(
id: UUID.generate().toString(), id: UUID.generate().toString(),
readStatus: ReadStatus.Read, readStatus: ReadStatus.Read,
received_at: incrementMessageCounter(), received_at: incrementMessageCounter(),
received_at_ms: timestamp, received_at_ms: groupTimestamp,
seenStatus: SeenStatus.NotApplicable, seenStatus: SeenStatus.NotApplicable,
sendStateByConversationId, sendStateByConversationId,
sent_at: timestamp, sent_at: groupTimestamp,
source: window.textsecure.storage.user.getNumber(), source: window.textsecure.storage.user.getNumber(),
sourceUuid: window.textsecure.storage.user.getUuid()?.toString(), sourceUuid: window.textsecure.storage.user.getUuid()?.toString(),
timestamp, timestamp: groupTimestamp,
type: 'story', type: 'story',
}); });