-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
606b7d8
to
202505e
Compare
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; | ||
} |
There was a problem hiding this comment.
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
3c915eb
to
ff3ee48
Compare
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.
ff3ee48
to
73c717c
Compare
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.
73c717c
to
2469e49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
return data; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je ne sais plus ce qui est préférable, mais une méthode existe la collection des contacts
https://github.com/cozy/cozy-client/blob/6b03c58ebef0e5c8455490b3300e36c803ca0565/packages/cozy-stack-client/src/ContactsCollection.js#L30C9-L30C19
@paultranvan, un avis ?
No description provided.