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

feat: write the contacts of twake:contacts:common by MontaGhanmy · Pull Request #4935 · linagora/cozy-stack · GitHub

feat: write the contacts of twake:contacts:common - #4935

Open
MontaGhanmy wants to merge 5 commits into
masterfrom
feat/common-contacts-consumer
Open

MontaGhanmy wants to merge 5 commits into
masterfrom
feat/common-contacts-consumer

Conversation

MontaGhanmy commented Sep 22, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

Summary

  • The stack consumes twake:contacts:common: a domain member is written on the organization instance, a personal contact on the instance whose email matches. A message for no instance here is acked and dropped.
  • A contact is keyed by its CardDAV path (carddavPath, indexed). One written before the feed, like the member copies, is taken over by email instead of duplicated.
  • Only the name, emails and phones come from the card. cozy, trustedForSharing and the groups stay as the stack set them, and x-twake-workplace-fqdn fills cozy only when it is empty.
  • A message that changes nothing writes nothing, so a republication does not bump every contact.
  • The organization instance is found with two indexed queries instead of listing every member instance.
  • Behind the common_contacts context setting, off by default.
  • Depends on feat: store the email on the instance #4934.

MontaGhanmy force-pushed the feat/instance-internal-email branch from f459d8d to 73cf9d0 Compare September 29, 2026 16:20
MontaGhanmy force-pushed the feat/common-contacts-consumer branch 3 times, most recently from 13bc02d to 046cfdd Compare September 30, 2026 16:01
Base automatically changed from feat/instance-internal-email to master October 1, 2026 08:34
Comment thread pkg/rabbitmq/common_contacts.go Outdated
Comment thread model/instance/lifecycle/get.go Outdated
Comment thread model/instance/lifecycle/get.go Outdated
if err != nil {
return nil, err
}
if len(members) == 0 || members[0].OrgID == "" {

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

Needs an instance carrying org_domain to find the org_id, otherwise member messages are dropped. Is that right for an organization with no member instance yet?

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

The org instance carries org_domain itself: the cloudery sends OrgDomain + OrgID together on create (stack.rb), so it finds itself even with zero members. Only checked the cloudery create path though, not instances created by hand or the data. I'll run a query on stg to be sure.

Comment thread pkg/rabbitmq/common_contacts.go Outdated
Comment thread pkg/rabbitmq/common_contacts.go Outdated
family, _ := name["familyName"].(string)
full = strings.TrimSpace(given + " " + family)
}
setOrDelete(c.M, "name", name, len(name) > 0)

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

name is deleted when the card has no components, fullname is kept. Intended?

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

Yes, intended. name mirrors the components, fullname the full name. A card with a full name and no components has no name to keep.

type CommonContactMessage struct {
Audience struct {
User string `json:"user"`
Domain string `json:"domain"`

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

why do we have domain here and don't have an org/tenant id?

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

sabre doesn't know about that. at most it knows the domain name guessed from email ( tops ). the rest if from ldap ( hmmm that we can send to sabre from ldap-rest )

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

but it should, how then multinancy will be done there and permissions? no, not should, it has to!

Comment thread model/instance/lifecycle/get.go Outdated

// GetOrgInstanceByOrgDomain retrieves the organization instance of an
// organization domain, without listing every member instance.
func GetOrgInstanceByOrgDomain(orgDomain string) (*instance.Instance, error) {

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

and this function already exists in the instance package

but I insist on org_id ) today we have one domain; tomorrow we move to another 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

Done, the duplicate is removed and we reuse the existing lookup now;

Comment thread pkg/rabbitmq/common_contacts.go Outdated
MontaGhanmy added a commit that referenced this pull request Oct 6, 2026
## Summary

- A sharer is trusted for drive auto accept when their instance has the
same `OrgID` as the recipient. The sender's instance is read on this
stack, so a member hosted elsewhere falls back to domain or contact
trust.
- Answering a sharing from a member of the same organization writes no
contact. Contact trust and `trustedForSharing` stay for people outside
the organization.
- Behind the `common_contacts` context setting, off by default, and
under `auto_accept_trusted` like the other kinds of trust.
- `HasCommonContacts` is the same as in #4935, so the two merge cleanly
in any order.

Part of linagora/twake-workplace-private#1777.
Members go on the organization instance, personal contacts on the
instance of their owner. The contact is keyed by its CardDAV path, and a
contact written before the feed is taken over by email. Behind the
common_contacts context setting, off by default.

This branch has not been deployed

No deployments
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