From 606b7d84d08e07ecc009119e29ead68906df800f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Fri, 15 Nov 2024 10:37:28 +0100 Subject: [PATCH] style: Prettier --- .../src/cozy/realtime/RealtimeNotifications.ts | 18 +++++++++++------- libs/cozy/sync.ts | 6 ++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/apps/browser/src/cozy/realtime/RealtimeNotifications.ts b/apps/browser/src/cozy/realtime/RealtimeNotifications.ts index e083776da2e5..26ad9d4cb0ca 100644 --- a/apps/browser/src/cozy/realtime/RealtimeNotifications.ts +++ b/apps/browser/src/cozy/realtime/RealtimeNotifications.ts @@ -65,12 +65,12 @@ export class RealTimeNotifications { const contactMustBeDisplayed = await shouldDisplayContact(this.client, data); if (contactMustBeDisplayed) { - this.logService.info(`Contact ${data.displayName} (${data._id}) added from realtime`) + this.logService.info(`Contact ${data.displayName} (${data._id}) added from realtime`); await this.upsertContactData(data); await dispatchCreate(this.client, "io.cozy.contacts", data as CouchDBDocument); } else { - this.logService.info(`Contact ${data.displayName} (${data._id}) not added from realtime`) + this.logService.info(`Contact ${data.displayName} (${data._id}) not added from realtime`); } } @@ -78,7 +78,7 @@ export class RealTimeNotifications { 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`) + this.logService.info(`Starting full sync from realtime because me`); this.messagingService.send("fullSync"); @@ -92,11 +92,15 @@ export class RealTimeNotifications { await dispatchUpdate(this.client, "io.cozy.contacts", data as CouchDBDocument); - this.logService.info(`Contact ${data.displayName} (${data._id}) added or updated from realtime because changed`) + this.logService.info( + `Contact ${data.displayName} (${data._id}) added or updated from realtime because changed`, + ); } else { await this.dispatchDeleteContact(data); - this.logService.info(`Contact ${data.displayName} (${data._id}) removed from realtime because changed`) + this.logService.info( + `Contact ${data.displayName} (${data._id}) removed from realtime because changed`, + ); } } @@ -125,7 +129,7 @@ export class RealTimeNotifications { every case. */ - this.logService.info(`Starting full sync from realtime because paper updated`) + this.logService.info(`Starting full sync from realtime because paper updated`); this.messagingService.send("fullSync"); } @@ -146,7 +150,7 @@ export class RealTimeNotifications { every case. */ - this.logService.info(`Starting full sync from realtime because paper deleted`) + this.logService.info(`Starting full sync from realtime because paper deleted`); this.messagingService.send("fullSync"); } diff --git a/libs/cozy/sync.ts b/libs/cozy/sync.ts index c1a1637b459c..e155bf40ffe0 100644 --- a/libs/cozy/sync.ts +++ b/libs/cozy/sync.ts @@ -24,9 +24,11 @@ export const shouldDisplayContact = async (client: CozyClient, contact: IOCozyCo const me = await fetchMyself(client); - const contactRelatedToMe = + const contactRelatedToMe = // @ts-expect-error related added manually with an hydration + me?.[0]?.relationships?.related?.data.find( // @ts-expect-error related added manually with an hydration - me?.[0]?.relationships?.related?.data.find((relatedContact) => relatedContact._id === contact._id); + (relatedContact) => relatedContact._id === contact._id, + ); if (contactRelatedToMe) { return true;