ensure that an incomplete pddb dict sigchat.account is deleted

This commit is contained in:
nworbnhoj 2023-12-28 15:26:53 +11:00
parent 3d5030f142
commit 89cdbc899e

View file

@ -226,10 +226,15 @@ impl<'a> SigChat<'a> {
Ok(true) => { Ok(true) => {
log::info!("Linked Signal Account"); log::info!("Linked Signal Account");
self.chat.set_busy_state(false); self.chat.set_busy_state(false);
Ok(Account::read(SIGCHAT_ACCOUNT)?)
} }
Ok(false) => { Ok(false) => {
log::info!("failed to link Signal Account"); log::info!("failed to link Signal Account");
self.chat.set_busy_state(false); self.chat.set_busy_state(false);
Err(Error::new(
ErrorKind::Other,
"failed to link Signal Account",
))
} }
Err(e) => { Err(e) => {
log::warn!("error while linking Signal Account: {e}"); log::warn!("error while linking Signal Account: {e}");
@ -240,6 +245,10 @@ impl<'a> SigChat<'a> {
self.modals self.modals
.show_notification(&format!("{}", e), None) .show_notification(&format!("{}", e), None)
.expect("notification failed"); .expect("notification failed");
Err(Error::new(
ErrorKind::Other,
"error while linking Signal Account",
))
} }
} }
} }
@ -251,9 +260,12 @@ impl<'a> SigChat<'a> {
self.modals self.modals
.show_notification(t!("sigchat.account.failed", locales::LANG), None) .show_notification(t!("sigchat.account.failed", locales::LANG), None)
.expect("notification failed"); .expect("notification failed");
Err(Error::new(
ErrorKind::Other,
"failed to create new Account in pddb",
))
} }
}; }
Ok(Account::read(SIGCHAT_ACCOUNT)?)
} }
/// Prompt a name from the user /// Prompt a name from the user