From 1158560a7f50fb962c6067e6c9d2d3ff25f6535b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 28 Nov 2023 17:57:31 +0000 Subject: check contacts --- routes/users.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routes/users.js b/routes/users.js index af9a036d..42538005 100644 --- a/routes/users.js +++ b/routes/users.js @@ -356,9 +356,11 @@ export default { payments.reverse().map(async (id) => await g(`payment:${id}`)) ) ).filter((p) => p.type === types.internal && p.ref)) { - let i = contacts.findIndex(({ id }) => id === ref) + let i = contacts.findIndex((c) => c && c.id === ref); if (~i) contacts.splice(i, 1); - contacts.unshift(await g(`user:${ref}`)); + let u = await g(`user:${ref}`); + if (typeof u === "string") u = await g(`user:${ref}`); + if (u) contacts.unshift(u); } await s(`${id}:contacts`, contacts); -- cgit v1.2.3