Repository navigation
fix(login): wait for the pending account removal before logging in again - #6810
ToteMeiSter wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk | ⚪ Minimal · up to
|
|
Hi @ToteMeiSter thank you for your contributions. |
|
This is a bug fix and all CodeRabbit review threads are resolved. Once it is approved and merged, would it be possible to backport it to Suggested command for a maintainer after merge: This comment was drafted with AI assistance (Claude Code). |
After "Remove account" the app restarted as soon as AccountRemovalWorker was SUCCEEDED, but the worker only started the push proxy request (async) and returned. The user row was still scheduled for deletion, so logging in with the same account ended in ExistingAccount and an app restart to the server address screen, without any message. The worker now blocks on the proxy request, and also deletes the user when the Nextcloud unregistration answers with another status than 200/202. When a login finds an account still scheduled for deletion, LoginRepository starts the removal and waits for it (30 s), then sets the account up as a new one. If the removal does not finish in time, an error is shown instead of silently restarting. Assisted-by: Claude-Code:claude-opus-5-5 Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru>
…nt removal The proxy answer has no body, so Retrofit emits null. A blocking subscriber queues the element and fails with a NullPointerException on it, which ended in onError for a successful request and skipped deleting the notification channel group. Wait for the request with ignoreElements() instead, which does not take the element, and delete the channel group when there is no error. Assisted-by: Claude-Code:claude-opus-5-5 Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru>
…PDX headers The CI checks detectNewJavaFiles and reuse-compliance-check failed on the pull request: new files must be written in Kotlin, and the two new test files had no SPDX-FileCopyrightText line. Rewrite AccountRemovalWorkerTest in Kotlin with the same two cases, remove the Java file and add the copyright line to both new test files. Assisted-by: Claude-Code:claude-opus-5-5 Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru>
ee0d1a6 to
75c7d2c
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Symptom
Remove an account and log in again with the same account right away, without restarting the app. After the browser login, Talk returns to the server address screen. There is no error message. After an app restart, the login works.
Cause
AccountRemovalWorkersent the push proxy unregister request with.subscribe(...). The Retrofit adapter runs onSchedulers.io(), so the call is asynchronous.doWork()returnedResult.success()before the user row was deleted.SUCCEEDED. A new login with the same account then reachesLoginRepository.parseAndLogin. The user is stillscheduledForDeletion, so it returnsExistingAccount. The app restarts with no accounts and shows the server address screen.Change
AccountRemovalWorkerwaits for the push proxy request withignoreElements().blockingGet().blockingSubscribecannot be used: the response body ofObservable<Void>is null, and the blocking observer of RxJava 2 throws an NPE on it.parseAndLogin: for an account that is still pending removal, it starts the worker again and waits up to 30 s for the removal (LocalLoginDataSource.awaitUserRemoval). After the removal, the account is set up as new. On timeout, the newLoginResult.RemovalPendingshows a Snackbar (nc_account_removal_pending) instead of the silent return to the server address screen.How to test
Unit tests:
AccountRemovalWorkerTest(a successful request with a null body is success; a failed request returns its error),LocalLoginDataSourceTest,LoginRepositoryTest.Tested by the reporter on a Huawei DEL-LX9.
Related
Refs #3544, #3295, #6716. These reports show the same symptom (the account cannot be added again, or the server address screen comes back). Their exact cause is not confirmed, so this PR does not close them.
Note: the open PR #6770 migrates
AccountRemovalWorkerto Kotlin. Whichever lands second needs a rebase; I can rebase this one.🖼️ Screenshots
Not applicable.
🚧 TODO
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)
This change was prepared with Claude Code (claude-opus-5-5). The author reviewed the code and tested it on a device. The commits carry the
Assisted-by: Claude-Code:claude-opus-5-5trailer.