diff options
| author | Adam Soltys <[email protected]> | 2025-01-29 05:30:02 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-01-29 05:30:04 +0000 |
| commit | 0b019a93a57f6f8fc9c3b9af8f003a61ebaee7de (patch) | |
| tree | 183cf482bf56161bde84763d8c7717632c160ef6 /lib | |
| parent | 3b6047b2dd77902301e21f94d2224387c2c81541 (diff) | |
| download | coinos-server-0b019a93a57f6f8fc9c3b9af8f003a61ebaee7de.tar.gz coinos-server-0b019a93a57f6f8fc9c3b9af8f003a61ebaee7de.zip | |
stringify follows
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nostr.ts | 5 |
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 }; |
