fix: show invite failed toast even if the first part of update failed

pull/3281/head
Audric Ackermann 5 months ago
parent b731ffc4ca
commit bc62b0ec40
No known key found for this signature in database

@ -660,6 +660,16 @@ async function handleMemberAddedFromUI({
updateMessagesToPush,
group
);
// schedule send invite details, auth signature, etc. to the new users
// those will fail is the pushChangesToGroupSwarmIfNeeded fails, but we still want
// to display the toasts message saying they failed
await scheduleGroupInviteJobs(
groupPk,
withHistory,
withoutHistory,
window.sessionFeatureFlags.useGroupV2InviteAsAdmin
);
await LibSessionUtil.saveDumpsToDb(groupPk);
// push new members & key supplement in a single batch call
const sequenceResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({
@ -669,21 +679,14 @@ async function handleMemberAddedFromUI({
unrevokeSubRequest,
extraStoreRequests,
});
await LibSessionUtil.saveDumpsToDb(groupPk);
if (sequenceResult !== RunJobResult.Success) {
throw new Error(
'handleMemberAddedFromUIOrNot: pushChangesToGroupSwarmIfNeeded did not return success'
);
}
// schedule send invite details, auth signature, etc. to the new users
await scheduleGroupInviteJobs(
groupPk,
withHistory,
withoutHistory,
window.sessionFeatureFlags.useGroupV2InviteAsAdmin
);
await LibSessionUtil.saveDumpsToDb(groupPk);
convo.set({
active_at: createAtNetworkTimestamp,
});

Loading…
Cancel
Save