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

Bugfix/4492/fix missing users in UI #4667

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mahibi
Copy link
Collaborator

@mahibi mahibi commented Jan 28, 2025

resolve #4492 (commits 307ebd3 and 22b8b59 might not fix the root cause but commit b69f215 makes sure DB state is healed)

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

…false

Before, getAnyUserAndSetAsActive did only set a random first user to current=true without to check if there is any other current user.

So it was up to the calling function of getAnyUserAndSetAsActive to check this.

I did not identify a scenario where the getAnyUserAndSetAsActive could cause to set multiple users to current, but anyway the new implementation might fix some scenario that i could not reproduce.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
…tActiveUser() is empty

To make sure getAnyUserAndSetAsActive() is invoked lazily and avoid any side effects, it's explicitly wrapped it in a lambda.

Maybe.defer ensures that getAnyUserAndSetAsActive() is not invoked until switchIfEmpty decides it’s needed.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
usersDao.getActiveUser() will return only one current users even if multiple exist for whatever reason.
By executing setUserAsActiveWithId(it.id) with the same user, it is made sure all other users current status is set to 0.

This change won't fix the root cause if multiple users are set to current, but it will make sure the state is fixed as soon as there is a query to get the active user.

In fact, this change might also make it harder to find the root cause because debugging may be more difficult! When searching for the root cause, always keep this in mind and maybe revert the change.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi self-assigned this Jan 28, 2025
Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4667-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings104104
Errors3636

SpotBugs

CategoryBaseNew
Bad practice66
Correctness222222
Dodgy code7171
Internationalization33
Malicious code vulnerability33
Performance44
Security11
Total310310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Account is missing in UI (-> Multiple current accounts in ChooseAccountDialogFragment)
1 participant