updateGroup: Update group attributes last, after notifications are added

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal
2022-02-23 12:25:50 -08:00
committed by GitHub
parent 5c8cc2dc94
commit 3d0abbe354
+15 -12
View File
@@ -2842,18 +2842,6 @@ async function updateGroup(
activeAt = newAttributes.active_at;
}
conversation.set({
...newAttributes,
active_at: activeAt,
temporaryMemberCount: isInGroup
? undefined
: newAttributes.temporaryMemberCount,
});
if (idChanged) {
conversation.trigger('idUpdated', conversation, 'groupId', previousId);
}
// Save all synthetic messages describing group changes
let syntheticSentAt = initialSentAt - (groupChangeMessages.length + 1);
const changeMessagesToSave = groupChangeMessages.map(changeMessage => {
@@ -2915,6 +2903,21 @@ async function updateGroup(
});
}
// We update group membership last to ensure that all notifications are in place before
// the group updates happen on the model.
conversation.set({
...newAttributes,
active_at: activeAt,
temporaryMemberCount: isInGroup
? undefined
: newAttributes.temporaryMemberCount,
});
if (idChanged) {
conversation.trigger('idUpdated', conversation, 'groupId', previousId);
}
// No need for convo.updateLastMessage(), 'newmessage' handler does that
}