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

Better management of realtime with contacts #334

Merged
merged 10 commits into from
Nov 18, 2024

Conversation

zatteo
Copy link

@zatteo zatteo commented Nov 14, 2024

No description provided.

@zatteo zatteo changed the title Fix/contacts displayed realtime Better management of realtime with contacts Nov 14, 2024
@zatteo zatteo force-pushed the fix/contacts-displayed-realtime branch 2 times, most recently from 606b7d8 to 202505e Compare November 15, 2024 12:51
libs/cozy/queries.ts Outdated Show resolved Hide resolved
libs/cozy/queries.ts Outdated Show resolved Hide resolved
libs/cozy/sync.ts Outdated Show resolved Hide resolved
Comment on lines 78 to 86
if (data.me) {
// We need to do a fullSync here because we have no other way to know
// if a contact related to me was removed of the me relation
this.logService.info(`Starting full sync from realtime because me`)

await dispatchUpdate(this.client, "io.cozy.contacts", data as CouchDBDocument);
this.messagingService.send("fullSync");

return;
}
Copy link
Member

Choose a reason for hiding this comment

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

Waiting new PR from cozy-contacts

@zatteo zatteo force-pushed the fix/contacts-displayed-realtime branch 2 times, most recently from 3c915eb to ff3ee48 Compare November 18, 2024 08:15
New name more precisely show that we only fetch me and favorites.
It was possible to add a contact in the browser extension from
realtime even if we did not want it in the browser extension.
=> a paper with potential contact inside
me[0] should exist here because every one has me. But after we should use it until the end.
@zatteo zatteo force-pushed the fix/contacts-displayed-realtime branch from ff3ee48 to 73c717c Compare November 18, 2024 08:21
I had to start with a special case for "me" update, because in Cozy
Contacts, relations were stored only in the contact who created the
relation.

So when "me" was updated, a relation of me could have been deleted,
and it was impossible to know which one easily, so it was impossible
to know if the contact should be removed from the extension.

With cozy/cozy-contacts#1020, relations are
propagated to the target contact.

So we will get a realtime event and we will be able to check if the
contact must be displayed or not without any special case.

And I can also check that a contact is related to me directly by checking
its relationships now.
@zatteo zatteo force-pushed the fix/contacts-displayed-realtime branch from 73c717c to 2469e49 Compare November 18, 2024 11:16
Copy link
Member

@Merkur39 Merkur39 left a comment

Choose a reason for hiding this comment

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

👍


return data;
};

Copy link
Member

Choose a reason for hiding this comment

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

@zatteo zatteo merged commit 5ee31dd into master Nov 18, 2024
1 check passed
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.

2 participants