updateGroup: Update group attributes last, after notifications are added
This commit is contained in:
parent
1f191401aa
commit
3673b6d101
1 changed files with 15 additions and 12 deletions
27
ts/groups.ts
27
ts/groups.ts
|
@ -2692,18 +2692,6 @@ async function updateGroup(
|
||||||
activeAt = newAttributes.active_at;
|
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
|
// Save all synthetic messages describing group changes
|
||||||
let syntheticSentAt = initialSentAt - (groupChangeMessages.length + 1);
|
let syntheticSentAt = initialSentAt - (groupChangeMessages.length + 1);
|
||||||
const changeMessagesToSave = groupChangeMessages.map(changeMessage => {
|
const changeMessagesToSave = groupChangeMessages.map(changeMessage => {
|
||||||
|
@ -2769,6 +2757,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
|
// No need for convo.updateLastMessage(), 'newmessage' handler does that
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue