From e2d5d6f874f620db242a3ec8fbe3e536b51f091a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 14 Oct 2024 09:08:39 -0700 Subject: default follows --- lib/nostr.ts | 4 ++-- lib/register.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/nostr.ts b/lib/nostr.ts index a58cb2c9..e4d695e5 100644 --- a/lib/nostr.ts +++ b/lib/nostr.ts @@ -156,7 +156,7 @@ export let getCount = async (pubkey) => { let follows = await g(`${pubkey}:follows:n`); let followers = await g(`${pubkey}:followers:n`); - if (!follows) { + if (follows === null) { let filter: any = { kinds: [3], authors: [pubkey] }; let ev = await pool.get([config.nostr], filter, opts); @@ -179,7 +179,7 @@ export let getCount = async (pubkey) => { await s(`${pubkey}:follows:n`, follows); } - if (!followers) { + if (followers === null) { let filter: any = { cache: ["user_infos", { pubkeys: [pubkey] }] }; let infos = await pool.querySync([config.cache], filter, opts); diff --git a/lib/register.ts b/lib/register.ts index f2e97fed..42a283a3 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -64,6 +64,8 @@ export default async (user, ip) => { .set(`user:${pubkey}`, id) .set(`balance:${id}`, 0) .set(`account:${id}`, account) + .set(`${pubkey}:follows:n`, 0) + .set(`${pubkey}:followers:n`, 0) .lPush(`${id}:accounts`, id) .exec(); -- cgit v1.2.3