Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not try to start I/O before deleting account #4104

Closed
link2xt opened this issue Sep 3, 2024 · 4 comments · Fixed by #4112
Closed

Do not try to start I/O before deleting account #4104

link2xt opened this issue Sep 3, 2024 · 4 comments · Fixed by #4112
Assignees
Labels
bug Something isn't working

Comments

@link2xt
Copy link
Collaborator

link2xt commented Sep 3, 2024

Currently if an account is imported from Android nightly or DeltaLab (now ArcaneChat) into the current Desktop with stable core 1.142.11, it fails to start I/O with a toast "Failed to start I/O: Invalid configured_imap_certificate_checks value". This is expected, user will need to update to the new core or reconfigure an account to make it usable.

The problem is that it is impossible to delete such broken account in the current Desktop 1.46.7. When user right-clicks the profile and selects "Delete Profile", desktop calls selectAccount here:

await this.selectAccount(accountId)

selectAccount is this function that tries to start I/O and fails:

async selectAccount(accountId: number) {
if (accountId !== this.selectedAccountId) {
await this.unSelectAccount()
this.selectedAccountId = accountId
;(window.__selectedAccountId as number) = accountId
} else {
log.info('account is already selected')
// do not return here as this can be the state transition between unconfigured to configured
}
const account = await BackendRemote.rpc.getAccountInfo(
this.selectedAccountId
)
if (account.kind === 'Configured') {
this.changeScreen(Screens.Main)
} else {
this.changeScreen(Screens.Welcome)
}
await BackendRemote.rpc.startIo(accountId)
runtime.setDesktopSetting('lastAccount', accountId)
log.info('system_info', await BackendRemote.rpc.getSystemInfo())
log.info('account_info', await BackendRemote.rpc.getInfo(accountId))
}

Desktop should not try to start I/O before deleting an account. If it fails, account cannot be deleted. Also if advanced setting "Only Synchronize Selected Profile" is enabled, I/O may have been stopped on purpose and starting I/O right before deleting an account is unnecessary.

@link2xt link2xt added the bug Something isn't working label Sep 3, 2024
@Simon-Laux
Copy link
Member

Simon-Laux commented Sep 3, 2024

So solution could be to add an argument to skip startIo and then from the delete screen call it with that argument?

Or simpler just omit the await or put it inside of a try/catch block to ignore the error? first one is better because of:

Also if advanced setting "Only Synchronize Selected Profile" is enabled, I/O may have been stopped on purpose and starting I/O right before deleting an account is unnecessary.

Why isstartIo part of selectAccount(id) in the first place?
Because there is a setting ("Only Synchronize Selected Profile") to restore the old behaviour of desktop where only the selected account is connected.
This is useful for some people that need more control about what accounts connect in public networks.
I started a pr to make core handle it instead of UI code in desktop a while ago: deltachat/deltachat-core-rust#5314

@adbenitez
Copy link
Member

This is useful for some people that need more control about what accounts connect in public networks.

for this in ArcaneChat we have ui.enabled and allow users to enable/disable accounts individually, that is more flexible than "enable selected account only" since then you can use ex. 2-3 needed accounts concurrently while the rest are disabled

@Simon-Laux
Copy link
Member

that is more flexible than "enable selected account only" since then you can use ex. 2-3 needed accounts concurrently while the rest are disabled

thats also what the core pr does. But there is still the usability question whether account should be started automatically when it is selected despite being disabled or if it should just stay disabled until the user enables it again.

@WofWca WofWca self-assigned this Sep 3, 2024
@adbenitez
Copy link
Member

adbenitez commented Sep 4, 2024

it should stay disabled, and a banner could be shown at the top saying "The profile is disabled [ENABLE]" ot so

similar to what Conversations(xmpp) does for disabled accounts
deltachat-2024-09-05-011733

WofWca added a commit that referenced this issue Sep 7, 2024
This is also a preparation to fix b broken account deletion:
#4104
WofWca added a commit that referenced this issue Sep 7, 2024
...imported from ArcaneChat, generated by a newer version of core.

Closes #4104.
WofWca added a commit that referenced this issue Sep 7, 2024
...imported from ArcaneChat, generated by a newer version of core.

Closes #4104.
Simon-Laux pushed a commit that referenced this issue Sep 8, 2024
This is also a preparation to fix b broken account deletion:
#4104
Simon-Laux pushed a commit that referenced this issue Sep 8, 2024
...imported from ArcaneChat, generated by a newer version of core.

Closes #4104.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants