From 00fda3160fcd26957e09cca2f093cd1d4a6717b7 Mon Sep 17 00:00:00 2001 From: Franz Geffke Date: Fri, 22 Sep 2023 20:31:51 +0100 Subject: [PATCH] client-web: refresh users on contact-list load --- packages/web/src/worker/worker.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/web/src/worker/worker.ts b/packages/web/src/worker/worker.ts index c25c30f..1c68c4c 100644 --- a/packages/web/src/worker/worker.ts +++ b/packages/web/src/worker/worker.ts @@ -380,6 +380,16 @@ export class NWorker { }; postMessage(msg); } + + await this.requestInformation( + { + source: "users", + idsOrKeys: contacts.map((c) => c.key), + }, + { + timeoutIn: TEN_SECONDS_IN_MS, + } + ); } /** @@ -1389,13 +1399,16 @@ export class NWorker { if (kind === NEVENT_KIND.METADATA) { const newUser = new NUserBase(); newUser.fromEvent(ev); - const data = { - user: newUser, - relayUrls: [payload.meta.url], - }; if (userRecord) { - await this.db.updateUser(ev.pubkey, data); + await this.db.updateUser(ev.pubkey, { + ...userRecord, + user: newUser, + }); } else { + const data = { + user: newUser, + relayUrls: [payload.meta.url], + }; await this.db.addUser(data); } }