fix: delete group messages only if push destroyed passed

pull/3281/head
Audric Ackermann 10 months ago
parent d12acc601f
commit 64fcc8934d
No known key found for this signature in database

@ -295,14 +295,14 @@ class ConvoController {
} }
} }
// now that we know we've sent the leave message, delete any remaining messages
await this.deleteConvoInitialChecks(groupPk, 'Group', false);
// a group 03 can be removed fully or kept empty as kicked. // a group 03 can be removed fully or kept empty as kicked.
// when it was pendingInvite, we delete it fully, // when it was pendingInvite, we delete it fully,
// when it was not, we empty the group but keep it with the "you have been kicked" message // when it was not, we empty the group but keep it with the "you have been kicked" message
// Note: the pendingInvite=true case cannot really happen as we wouldn't be polling from that group (and so, not get the message kicking us) // Note: the pendingInvite=true case cannot really happen as we wouldn't be polling from that group (and so, not get the message kicking us)
if (deletionType === 'keepAsKicked' || deletionType === 'keepAsDestroyed') { if (deletionType === 'keepAsKicked' || deletionType === 'keepAsDestroyed') {
// now that we know we've sent the leave message, delete any remaining messages
await this.deleteConvoInitialChecks(groupPk, 'Group', false);
// delete the secretKey/authData if we had it. If we need it for something, it has to be done before this call. // delete the secretKey/authData if we had it. If we need it for something, it has to be done before this call.
if (groupInUserGroup) { if (groupInUserGroup) {
groupInUserGroup.authData = null; groupInUserGroup.authData = null;
@ -380,11 +380,13 @@ class ConvoController {
// if that group was already freed this will happen. // if that group was already freed this will happen.
// we still want to delete it entirely though // we still want to delete it entirely though
window.log.warn( window.log.warn(
`deleteGroup: MetaGroupWrapperActions failed with: ${e.message}... Keeping it as this should be a retryable error` `deleteGroup: MetaGroupWrapperActions failed with: ${e.message}... Keeping it as this should be a retryable error (we are admin case)`
); );
throw e; throw e;
} }
} }
// now that we know we've pushed the group as destroyed, destroy the group's messages locally
await this.deleteConvoInitialChecks(groupPk, 'Group', false);
// this deletes the secretKey if we had it. If we need it for something, it has to be done before this call. // this deletes the secretKey if we had it. If we need it for something, it has to be done before this call.
await UserGroupsWrapperActions.eraseGroup(groupPk); await UserGroupsWrapperActions.eraseGroup(groupPk);

Loading…
Cancel
Save