diff options
| -rw-r--r-- | lib/nostr.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/nostr.ts b/lib/nostr.ts index 2e1dcd71..a58cb2c9 100644 --- a/lib/nostr.ts +++ b/lib/nostr.ts @@ -173,8 +173,10 @@ export let getCount = async (pubkey) => { follows = ev.tags .map((t) => t[0] === "p" && t[1]) .filter((p) => p && p.length === 64).length; - await s(`${pubkey}:follows:n`, follows); } + + follows ||= 0; + await s(`${pubkey}:follows:n`, follows); } if (!followers) { @@ -186,12 +188,11 @@ export let getCount = async (pubkey) => { if (f && f.content) { counts = JSON.parse(f.content); followers = counts[pubkey]; - await s(`${pubkey}:followers:n`, followers); } - } - follows ||= 0; - followers ||= 0; + followers ||= 0; + await s(`${pubkey}:followers:n`, followers); + } return { follows, followers }; }; |
