Repository navigation
fix: open phone book contacts with the account of their server - #6938
Merged
Merged
Conversation
The phone book integration syncs for the account that is the default at the time, so a contact entry can belong to another account than the current default one, e.g. after switching it. Opening such a contact only compared it with the default account and reported that no account was found, although one exists. Choose the account by the server in the contact's cloud ID: the default account if it is on that server, otherwise another account on it. Also compare the server exactly instead of with endsWith(), which matched https://mycloud.example.com for a contact on cloud.example.com. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Contributor
Contributor
📱 QA build
The QA build installs alongside a released Nextcloud app, so you can keep Downloading the file requires a GitHub account, so open this link on the |
mahibi
self-requested a review
October 23, 2026 08:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening a Nextcloud contact from the Android Contacts app ("Chat via Talk") reported "account not found" for contacts that belong to an existing account other than the current default one.
Cause: the phone book integration (
ContactAddressBookWorker) syncs for the account that is the default at the time, and stores the contact's cloud ID (user@host[/path]). After switching the default account, entries synced for the previous one remain.MainActivity.openChatOfContact()only compared the contact's server with the current default account, so these contacts could not be opened although their account exists.Fix: choose the account by the server in the contact's cloud ID: the default account if it is on that server, otherwise another account on it (
MainActivity.accountForContactServer()). The error is only shown if no account is on that server.The server is now compared exactly (scheme stripped, trailing slash and case ignored) instead of with
currentUser.baseUrl.endsWith(server), which also matched e.g.https://mycloud.example.comfor a contact oncloud.example.com.The snackbar for the "account not found" case is left as is here; #6937 turns it into a toast, as it was shown underneath the conversation list.
Tests:
MainActivityContactAccountTestcovers default account, another account on the contact's server, no default account, no matching account, suffix-only match, path, case/trailing slash and invalid servers. ktlint clean; detekt only reports the existingCyclomaticComplexMethodonhandleIntent(same on master).🖼️ Screenshots
🚧 TODO
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)