Commit 15285ebe authored by Michael Gratton's avatar Michael Gratton 🤞

Merge branch 'wip/fix-error-on-goa-account-disabled' into 'master'

Fix an error being thrown when an active GOA account is disabled

See merge request !165
parents 833f1d5c 1e826e9f
Pipeline #65705 passed with stages
in 18 minutes and 42 seconds
......@@ -784,11 +784,10 @@ public class Accounts.Manager : GLib.Object {
}
private bool is_valid_goa_account(Goa.Object handle) {
// Goa.Account.mail_disabled doesn't seem to reflect if we get
// get a valid mail object here, so just rely on that instead.
Goa.Mail? mail = handle.get_mail();
return (
mail != null &&
!handle.get_account().mail_disabled &&
!Geary.String.is_empty(mail.imap_host) &&
!Geary.String.is_empty(mail.smtp_host)
);
......@@ -838,15 +837,18 @@ public class Accounts.Manager : GLib.Object {
}
private async void update_goa_account(Geary.AccountInformation account,
bool is_available,
GLib.Cancellable? cancellable) {
GoaMediator mediator = (GoaMediator) account.mediator;
try {
yield mediator.update(account, cancellable);
if (is_available) {
// Update will clear the creds, so make sure they get
// refreshed
yield account.load_outgoing_credentials(cancellable);
yield account.load_incoming_credentials(cancellable);
}
} catch (GLib.Error err) {
report_problem(
new Geary.AccountProblemReport(
......@@ -856,9 +858,7 @@ public class Accounts.Manager : GLib.Object {
));
}
// XXX need to notify the engine that creds may have changed
set_available(account, mediator.is_available);
set_available(account, is_available);
}
......@@ -929,7 +929,11 @@ public class Accounts.Manager : GLib.Object {
// We already know about this account, so check that it is
// still valid. If not, the account should be disabled,
// not deleted, since it may be re-enabled at some point.
this.update_goa_account.begin(state.account, null);
this.update_goa_account.begin(
state.account,
is_valid_goa_account(account),
null
);
} else {
// We haven't created an account for this GOA account
// before, so try doing so now.
......
......@@ -10,15 +10,6 @@
public class GoaMediator : Geary.CredentialsMediator, Object {
public bool is_available {
get {
// Goa.Account.mail_disabled doesn't seem to reflect if we
// get can get a valid mail object or not, so just rely on
// actually getting one instead.
return this.handle.get_mail() != null;
}
}
private Goa.Object handle;
......@@ -111,7 +102,7 @@ public class GoaMediator : Geary.CredentialsMediator, Object {
// password" or "GOA credentials need renewing" or
// something. Connect to the GOA service and wait until we
// hear that needs attention is no longer true.
return this.is_available;
return false;
}
private Geary.Credentials.Method get_auth_method() throws GLib.Error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment