aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-11-28 17:57:31 +0000
committerAdam Soltys <[email protected]>2023-11-28 17:57:40 +0000
commit1158560a7f50fb962c6067e6c9d2d3ff25f6535b (patch)
tree3022078ee9fc1a34edb66af48a6690940be32324
parent644a003e4609f610343805a08f1cd5ed81d85b96 (diff)
downloadcoinos-server-1158560a7f50fb962c6067e6c9d2d3ff25f6535b.tar.gz
coinos-server-1158560a7f50fb962c6067e6c9d2d3ff25f6535b.zip
check contacts
-rw-r--r--routes/users.js6
1 files 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);