move removing group member record logic after the leaving message is successfully sent

pull/799/head
ryanzhao 3 years ago
parent 282230c87a
commit 5ec51a99c6

@ -533,16 +533,6 @@ extension MessageSender {
variant: .infoClosedGroupCurrentUserLeft,
body: "GROUP_YOU_LEFT".localized()
).update(db)
}
seal.fulfill((interactionId, nil))
}
.catch { error in
seal.fulfill((interactionId, error))
}
}
catch {
seal.fulfill((interactionId, error))
}
// Update the group (if the admin leaves the group is disbanded)
let wasAdminUser: Bool = try GroupMember
@ -562,6 +552,16 @@ extension MessageSender {
.filter(GroupMember.Columns.profileId == userPublicKey)
.deleteAll(db)
}
}
seal.fulfill((interactionId, nil))
}
.catch { error in
seal.fulfill((interactionId, error))
}
}
catch {
seal.fulfill((interactionId, error))
}
// Return
return promise

Loading…
Cancel
Save