FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(common-contacts): resolve share emails on org first by MontaGhanmy · Pull Request #4939 · linagora/cozy-stack · GitHub

Repository navigation

feat(common-contacts): resolve share emails on org first - #4939

Merged
shepilov merged 13 commits into
masterfrom
feat/share-by-email
Oct 13, 2026
Merged

shepilov merged 13 commits into
masterfrom
feat/share-by-email

Conversation

MontaGhanmy commented Sep 23, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

Summary

  • A sharing recipient can be given by email, {"type": "io.cozy.contacts", "email": "..."}, on every route that adds recipients (create, add, drives, delegated add).
  • The email is looked up in the contacts of the organization instance first, then in the contacts of the instance. When nothing matches, the contact is created on the instance, marked external so the common contacts feed takes it over. The member is built from the contact as for a contact id.
  • Emails are accepted in any context, as in the storage ADR (docs: add organization members and contacts storage adr #4917). common_contacts only decides who writes the contact afterwards.
  • An invalid address is rejected with a 422, and a contact created for an add that fails is removed.
  • Contact ids and group ids work as before. The three recipient parsers are now one (extractRecipients).
  • Emails are matched as given: the contacts view is case-sensitive and the feed stores addresses unchanged.
  • Depends on feat: write the contacts of twake:contacts:common #4935.

Part of linagora/twake-workplace-private#1775.

Comment thread web/sharings/drives.go Outdated

// extractRecipientIDs extracts group and contact IDs from a JSON:API relationship.
func extractRecipientIDs(obj *jsonapi.ObjectMarshalling, relationshipName string) (groupIDs, contactIDs []string) {
func extractRecipients(inst *instance.Instance, obj *jsonapi.ObjectMarshalling, relationshipName string) (groupIDs, contactIDs, emails []string) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This API should be changes, I don't know how yet, but there is should not be difference from the client side, do we add a "common" contact or group, or just personal one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Emails now work the same whatever the context, the client just sends {"type": "io.cozy.contacts", "email": ...} and the stack figures out where the contact lives.

MontaGhanmy force-pushed the feat/common-contacts-consumer branch from 5870d80 to c58e3bd Compare September 30, 2026 08:25
MontaGhanmy force-pushed the feat/common-contacts-consumer branch from c58e3bd to 13bc02d Compare September 30, 2026 09:23
MontaGhanmy force-pushed the feat/common-contacts-consumer branch from 13bc02d to 046cfdd Compare September 30, 2026 16:01
Comment thread web/sharings/drives.go Outdated
id, ok := refMap["id"].(string)
if !ok {
// Without common contacts, a ref without id is ignored as before.
if email, _ := refMap["email"].(string); email != "" && inst.HasCommonContacts() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

An email ref is silently dropped when the context has no common_contacts: the client gets a 200 with a sharing that has fewer members than it asked for.

The lookup and the create work without the feed too, so either accept emails always or reject the request. This is also anton's point above: the client should not have to know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Dropped the gate as in the storage ADR, so emails are always accepted and common_contacts only decides who writes the contact afterwards.

Comment thread model/sharing/member.go Outdated
Comment thread model/sharing/member.go Outdated
Comment thread web/sharings/sharings.go
}
}
}
for _, rel := range []string{"recipients", "read_only_recipients"} {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The rewrite changes the member order: contacts first, then emails, then groups, where it used to follow the order of the relationship. Member indexes end up in the invitation URLs, so this is worth a check that nothing depends on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No consumer of the order. The index is fixed in addMember and the invitation only goes through that member's credentials (Credentials[idx-1]). AddRecipients already did contacts then groups, so this aligns CreateSharing with it.

shepilov force-pushed the feat/common-contacts-consumer branch from b6fd27d to f0ca128 Compare October 6, 2026 13:43
Base automatically changed from feat/common-contacts-consumer to master October 10, 2026 09:42
shepilov force-pushed the feat/share-by-email branch from 7745942 to 915ec78 Compare October 13, 2026 15:45
MontaGhanmy and others added 7 commits October 13, 2026 19:01
…ntacts after the add

The service is passed to AddGroupsAndContacts, AddEmail and
DelegateAddContactsAndGroups instead of a package global. A contact is
published only once the member is added, so one removed after a failed
add never reaches Sabre. The publish decision moves to collectedRequest
so its negative cases are tested synchronously.
The sharing methods no longer take the RabbitMQ service. A
share-collected-contacts job publishes the created contacts and retries
a failed publish. Contacts created by a request that fails later are
published too, as they are kept.
… member

The emails are resolved on the member's instance, like the contacts, and
the contacts created for them are published.
shepilov merged commit 2a038d6 into master Oct 13, 2026
4 checks passed
shepilov deleted the feat/share-by-email branch October 13, 2026 17:45
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL