Using the group story timestamp when adding to the conversation job queue
This commit is contained in:
parent
e37e3dc82c
commit
ba55285c74
2 changed files with 19 additions and 11 deletions
|
@ -82,11 +82,10 @@ export async function sendStory(
|
|||
return;
|
||||
}
|
||||
|
||||
const messageTimestamp = message.get('timestamp');
|
||||
const messageConversation = message.getConversation();
|
||||
if (messageConversation !== conversation) {
|
||||
log.error(
|
||||
`stories.sendStory(${messageTimestamp}): Message conversation '${messageConversation?.idForLogging()}' does not match job conversation ${conversation.idForLogging()}`
|
||||
`stories.sendStory(${timestamp}): Message conversation '${messageConversation?.idForLogging()}' does not match job conversation ${conversation.idForLogging()}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -96,7 +95,7 @@ export async function sendStory(
|
|||
|
||||
if (!attachment) {
|
||||
log.info(
|
||||
`stories.sendStory(${messageTimestamp}): message does not have any attachments to send. Giving up on sending it`
|
||||
`stories.sendStory(${timestamp}): message does not have any attachments to send. Giving up on sending it`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -177,18 +176,26 @@ export async function sendStory(
|
|||
return;
|
||||
}
|
||||
|
||||
const messageTimestamp = message.get('timestamp');
|
||||
if (message.get('timestamp') !== timestamp) {
|
||||
log.error(
|
||||
`stories.sendStory(${timestamp}): Message timestamp ${message.get(
|
||||
'timestamp'
|
||||
)} does not match job timestamp`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const messageConversation = message.getConversation();
|
||||
if (messageConversation !== conversation) {
|
||||
log.error(
|
||||
`stories.sendStory(${messageTimestamp}): Message conversation '${messageConversation?.idForLogging()}' does not match job conversation ${conversation.idForLogging()}`
|
||||
`stories.sendStory(${timestamp}): Message conversation '${messageConversation?.idForLogging()}' does not match job conversation ${conversation.idForLogging()}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.isErased() || message.get('deletedForEveryone')) {
|
||||
log.info(
|
||||
`stories.sendStory(${messageTimestamp}): message was erased. Giving up on sending it`
|
||||
`stories.sendStory(${timestamp}): message was erased. Giving up on sending it`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -200,7 +207,7 @@ export async function sendStory(
|
|||
|
||||
if (!receiverId) {
|
||||
log.info(
|
||||
`stories.sendStory(${messageTimestamp}): did not get a valid recipient ID for message. Giving up on sending it`
|
||||
`stories.sendStory(${timestamp}): did not get a valid recipient ID for message. Giving up on sending it`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -227,7 +234,7 @@ export async function sendStory(
|
|||
|
||||
if (!shouldContinue) {
|
||||
log.info(
|
||||
`stories.sendStory(${messageTimestamp}): ran out of time. Giving up on sending it`
|
||||
`stories.sendStory(${timestamp}): ran out of time. Giving up on sending it`
|
||||
);
|
||||
await markMessageFailed(message, [
|
||||
new Error('Message send ran out of time'),
|
||||
|
@ -257,7 +264,7 @@ export async function sendStory(
|
|||
}
|
||||
);
|
||||
throw new Error(
|
||||
`stories.sendStory(${messageTimestamp}): sending blocked because ${untrustedUuids.length} conversation(s) were untrusted. Failing this attempt.`
|
||||
`stories.sendStory(${timestamp}): sending blocked because ${untrustedUuids.length} conversation(s) were untrusted. Failing this attempt.`
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -282,7 +289,7 @@ export async function sendStory(
|
|||
);
|
||||
|
||||
log.info(
|
||||
`stories.sendStory(${messageTimestamp}): sending story to ${receiverId}`
|
||||
`stories.sendStory(${timestamp}): sending story to ${receiverId}`
|
||||
);
|
||||
|
||||
const storyMessage = new Proto.StoryMessage();
|
||||
|
|
|
@ -310,7 +310,8 @@ export async function sendStoryMessage(
|
|||
type: conversationQueueJobEnum.enum.Story,
|
||||
conversationId,
|
||||
messageIds: [messageAttributes.id],
|
||||
timestamp,
|
||||
// using the group timestamp, which will differ from the 1:1 timestamp
|
||||
timestamp: messageAttributes.timestamp,
|
||||
},
|
||||
async jobToInsert => {
|
||||
const model = new window.Whisper.Message(messageAttributes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue