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) {
|
if (syncMessage.sent) {
|
||||||
const sentMessage = syncMessage.sent;
|
const sentMessage = syncMessage.sent;
|
||||||
|
|
||||||
if (sentMessage.storyMessage) {
|
|
||||||
this.handleStoryMessage(
|
|
||||||
envelope,
|
|
||||||
sentMessage.storyMessage,
|
|
||||||
sentMessage
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sentMessage.storyMessageRecipients && sentMessage.isRecipientUpdate) {
|
if (sentMessage.storyMessageRecipients && sentMessage.isRecipientUpdate) {
|
||||||
if (window.Events.getHasStoriesDisabled()) {
|
if (window.Events.getHasStoriesDisabled()) {
|
||||||
log.info(
|
log.info(
|
||||||
|
@ -2721,6 +2712,15 @@ export default class MessageReceiver
|
||||||
return this.dispatchAndWait(ev);
|
return this.dispatchAndWait(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sentMessage.storyMessage) {
|
||||||
|
this.handleStoryMessage(
|
||||||
|
envelope,
|
||||||
|
sentMessage.storyMessage,
|
||||||
|
sentMessage
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sentMessage || !sentMessage.message) {
|
if (!sentMessage || !sentMessage.message) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'MessageReceiver.handleSyncMessage: sync sent message was missing message'
|
'MessageReceiver.handleSyncMessage: sync sent message was missing message'
|
||||||
|
|
|
@ -76,15 +76,15 @@ export async function onStoryRecipientUpdate(
|
||||||
const messages = await window.Signal.Data.getMessagesBySentAt(timestamp);
|
const messages = await window.Signal.Data.getMessagesBySentAt(timestamp);
|
||||||
|
|
||||||
// Now we figure out who needs to be added and who needs to removed
|
// 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)) {
|
if (!isStory(item)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { sendStateByConversationId, storyDistributionListId } = item;
|
const { sendStateByConversationId, storyDistributionListId } = item;
|
||||||
|
|
||||||
if (!sendStateByConversationId || !storyDistributionListId) {
|
if (!sendStateByConversationId || !storyDistributionListId) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextSendStateByConversationId = {
|
const nextSendStateByConversationId = {
|
||||||
|
@ -136,7 +136,7 @@ export async function onStoryRecipientUpdate(
|
||||||
log.info(
|
log.info(
|
||||||
'onStoryRecipientUpdate: sendStateByConversationId does not need update'
|
'onStoryRecipientUpdate: sendStateByConversationId does not need update'
|
||||||
);
|
);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = window.MessageController.register(item.id, item);
|
const message = window.MessageController.register(item.id, item);
|
||||||
|
@ -170,9 +170,13 @@ export async function onStoryRecipientUpdate(
|
||||||
});
|
});
|
||||||
queueUpdateMessage(message.attributes);
|
queueUpdateMessage(message.attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
window.Whisper.events.trigger('incrementProgress');
|
if (handledMessages.length) {
|
||||||
confirm();
|
window.Whisper.events.trigger('incrementProgress');
|
||||||
|
confirm();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue