[Bug]: Recently contacted stores the same local user twice when contacted via share (UID) and calendar (email)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
If you have a user named "User2 user2@example.net" on your Nextcloud instance, and you share a file with User2 and invite them to an event, they will appear twice in the "Recently contacted" address book. From Share I get "UID and Name without email" and from Calendar I get "email without name"
Steps to reproduce
- Create a NC user with name and email. Example "User2" with "user2@example.net"
- Enable: Admin -> Groupware -> "Enable System Address Book" (you need this for Step 4)
- Share a file with "User2"
- Create and save an event with "User2" as an attendee
- Check your "Recently contacted" List
Expected behavior
Since I interacted with the same instance user in both cases, I expect to see User2 only once in "Recently Contacted" with UID/Name/Email - not twice, each holding only part of the information
this requires:
- When sharing files, save not only the UID and name but also the email address (if available)
- When inviting users to appointments, don't just save the email address - also lookup and save the UID and name (if there is only one user with that email address)
Nextcloud Server version
35 (master)
Operating system
None
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Enabled:
- appstore: 2.0.0-dev.0
- calendar: 6.5.0-dev.0
- circles: 35.0.0-dev.0
- cloud_federation_api: 2.0.0-dev.0
- comments: 2.0.0-dev.0
- contacts: 8.8.0-dev.0
- contactsinteraction: 2.0.0-dev.0
- dashboard: 8.0.0-dev.0
- dav: 2.0.0-dev.0
- federatedfilesharing: 2.0.0-dev.0
- federation: 2.0.0-dev.0
- files: 3.0.0-dev.0
- files_reminders: 2.0.0-dev.0
- files_sharing: 2.0.0-dev.0
- files_trashbin: 2.0.0-dev.0
- files_versions: 2.0.0-dev.0
- lookup_server_connector: 2.0.0-dev.0
- oauth2: 2.0.0-dev.0
- profile: 2.0.0-dev.0
- provisioning_api: 2.0.0-dev.0
- settings: 2.0.0-dev.0
- sharebymail: 2.0.0-dev.0
- systemtags: 2.0.0-dev.0
- theming: 3.0.0-dev.0
- twofactor_backupcodes: 2.0.0-dev.0
- updatenotification: 2.0.0-dev.0
- user_status: 2.0.0-dev.0
- weather_status: 2.0.0-dev.0
- webhook_listeners: 2.0.0-dev.0
- workflowengine: 3.0.0-dev.0
Nextcloud Signing status
Nextcloud Logs
Additional info
I'm aware that this cannot be solved completely. There are users without an email address. Or multiple users sharing the same email address. But for a cleanly maintained NC instance with unique users, I still see value in it. The question is how much effort/risk is justified. As background info: entries are removed automatically after 7 days without renewed contact.
Questions for the maintainers:
-
Just enriching the entry with the email address on the sharing path would probably already give us the improvement when, after sharing, the same user is invited to an event via email. Are you OK with this approach?
-
For an event attendee, only the email address is known at save time. So we could try
getByEmail(email), and if that returns exactly one result, then tryfindMatchwith the uid or email. If a match exists, update the timestamp; if not, generate the contact with UID/Name/CloudID/email. Are you OK with this approach?
Note: #31606 was addressed by #41046, but only deduplicates against the user's personal address books. The cases here - same-instance users (system address book) and the UID-vs-email split - aren't covered.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the file-sharing and calendar attendee paths that populate the Recently contacted address book, then compare how each path identifies and stores the same local user. Done means a single same-instance user entry is updated with available UID, name, and email data rather than creating separate partial entries, with regression coverage for both interaction orders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100