aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-29 05:30:02 +0000
committerAdam Soltys <[email protected]>2025-01-29 05:30:04 +0000
commit0b019a93a57f6f8fc9c3b9af8f003a61ebaee7de (patch)
tree183cf482bf56161bde84763d8c7717632c160ef6
parent3b6047b2dd77902301e21f94d2224387c2c81541 (diff)
downloadcoinos-server-0b019a93a57f6f8fc9c3b9af8f003a61ebaee7de.tar.gz
coinos-server-0b019a93a57f6f8fc9c3b9af8f003a61ebaee7de.zip
stringify follows
-rw-r--r--lib/nostr.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/nostr.ts b/lib/nostr.ts
index aca518b6..0bb01521 100644
--- a/lib/nostr.ts
+++ b/lib/nostr.ts
@@ -158,7 +158,7 @@ export const getCount = async (pubkey) => {
if (follows === null) {
const result = await get({ authors: [pubkey], kinds: [3] });
follows = result ? result.tags.filter((t) => t[0] === "p").length : 0;
- await db.set(`${pubkey}:follows:n`, follows, { EX });
+ if (follows?.length) await db.set(`${pubkey}:follows:n`, JSON.stringify(follows), { EX });
}
const k = `${pubkey}:followers:n`;
@@ -169,7 +169,8 @@ export const getCount = async (pubkey) => {
"#p": [pubkey],
kinds: [3],
});
- await db.set(k, followers, { EX });
+
+ if (followers?.length) await db.set(k, JSON.stringify(followers), { EX });
}
return { follows, followers };