Handle storyMessageRecipient updates before handling story messages
This commit is contained in:
parent
b950480d36
commit
3bfeffe502
2 changed files with 19 additions and 15 deletions
|
@ -2688,15 +2688,6 @@ export default class MessageReceiver
|
|||
if (syncMessage.sent) {
|
||||
const sentMessage = syncMessage.sent;
|
||||
|
||||
if (sentMessage.storyMessage) {
|
||||
this.handleStoryMessage(
|
||||
envelope,
|
||||
sentMessage.storyMessage,
|
||||
sentMessage
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sentMessage.storyMessageRecipients && sentMessage.isRecipientUpdate) {
|
||||
if (window.Events.getHasStoriesDisabled()) {
|
||||
log.info(
|
||||
|
@ -2721,6 +2712,15 @@ export default class MessageReceiver
|
|||
return this.dispatchAndWait(ev);
|
||||
}
|
||||
|
||||
if (sentMessage.storyMessage) {
|
||||
this.handleStoryMessage(
|
||||
envelope,
|
||||
sentMessage.storyMessage,
|
||||
sentMessage
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sentMessage || !sentMessage.message) {
|
||||
throw new Error(
|
||||
'MessageReceiver.handleSyncMessage: sync sent message was missing message'
|
||||
|
|
|
@ -76,15 +76,15 @@ export async function onStoryRecipientUpdate(
|
|||
const messages = await window.Signal.Data.getMessagesBySentAt(timestamp);
|
||||
|
||||
// Now we figure out who needs to be added and who needs to removed
|
||||
messages.forEach(item => {
|
||||
const handledMessages = messages.filter(item => {
|
||||
if (!isStory(item)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const { sendStateByConversationId, storyDistributionListId } = item;
|
||||
|
||||
if (!sendStateByConversationId || !storyDistributionListId) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const nextSendStateByConversationId = {
|
||||
|
@ -136,7 +136,7 @@ export async function onStoryRecipientUpdate(
|
|||
log.info(
|
||||
'onStoryRecipientUpdate: sendStateByConversationId does not need update'
|
||||
);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const message = window.MessageController.register(item.id, item);
|
||||
|
@ -170,9 +170,13 @@ export async function onStoryRecipientUpdate(
|
|||
});
|
||||
queueUpdateMessage(message.attributes);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
window.Whisper.events.trigger('incrementProgress');
|
||||
confirm();
|
||||
if (handledMessages.length) {
|
||||
window.Whisper.events.trigger('incrementProgress');
|
||||
confirm();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue