From c87db6d1f8bca1137aa6394ab9a433ad44231290 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Fri, 26 Apr 2024 16:05:53 -0300 Subject: [PATCH] refactor: remove muteList as a field --- src/storages/UserStore.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/storages/UserStore.ts b/src/storages/UserStore.ts index f9cc068d..615e2afd 100644 --- a/src/storages/UserStore.ts +++ b/src/storages/UserStore.ts @@ -5,12 +5,10 @@ import { getTagSet } from '@/tags.ts'; export class UserStore implements NStore { private store: NStore; private pubkey: string; - private muteList: Promise; constructor(pubkey: string, store: NStore) { this.pubkey = pubkey; this.store = store; - this.muteList = this.getMuteList(); } async event(event: NostrEvent, opts?: { signal?: AbortSignal }): Promise { @@ -24,7 +22,7 @@ export class UserStore implements NStore { async query(filters: NostrFilter[], opts: { signal?: AbortSignal; limit?: number } = {}): Promise { const allEvents = await this.store.query(filters, opts); - const mutedPubkeysEvent = await this.muteList; + const mutedPubkeysEvent = await this.getMuteList(); if (!mutedPubkeysEvent) { return allEvents; } @@ -36,10 +34,7 @@ export class UserStore implements NStore { } private async getMuteList(): Promise { - const [muteList] = await this.query([{ authors: [this.pubkey], kinds: [10000], limit: 1 }], { - signal: AbortSignal.timeout(5000), - limit: 1, - }); + const [muteList] = await this.store.query([{ authors: [this.pubkey], kinds: [10000], limit: 1 }]); return muteList; } }