Prevent bug where user account not deleted if changes were pending

This commit is contained in:
Emi Tatsuo 2020-12-16 19:51:37 -05:00
parent 00584c2f27
commit ac9650977b
Signed by: Emi
GPG key ID: 68FAB2E2E6DFC98B

View file

@ -415,7 +415,10 @@ impl<UserData: Serialize + DeserializeOwned> RegisteredUser<UserData> {
///
/// # Errors
/// Can error if the a database error occurs
pub fn delete(self) -> Result<()> {
pub fn delete(mut self) -> Result<()> {
// Prevent re-saving on drop
self.has_changed = false;
let certificates = self.all_certificates();
(&self.manager.users, &self.manager.certificates, &self.manager.usernames).transaction(|(tx_usr, tx_crt, tx_nam)| {