From 480178c5a85bf0e606335fc618c43aecfbab3b37 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Sun, 11 Oct 2026 20:16:31 +0700 Subject: [PATCH] clean up --- crates/person/src/lib.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/person/src/lib.rs b/crates/person/src/lib.rs index 69e380e5..91e035e2 100644 --- a/crates/person/src/lib.rs +++ b/crates/person/src/lib.rs @@ -18,9 +18,6 @@ pub fn init(cx: &mut App) { PersonRegistry::set_global(cx.new(PersonRegistry::new), cx); } -/// The emoji list event kind (NIP-51) -const KIND_EMOJIS: Kind = Kind::Custom(10030); - struct GlobalPersonRegistry(Entity); impl Global for GlobalPersonRegistry {} @@ -58,9 +55,9 @@ impl PersonRegistry { /// Create a new person registry instance fn new(cx: &mut Context) -> Self { - let entity = cx.entity().downgrade(); let nostr = NostrRegistry::global(cx); let client = nostr.read(cx).client(); + let entity = cx.entity().downgrade(); // Channel for communication between nostr and gpui let (tx, rx) = flume::bounded::(100); @@ -238,7 +235,7 @@ impl PersonRegistry { type EmojiLists = Vec<(PublicKey, Vec<(String, Url)>)>; let task: Task> = cx.background_spawn(async move { - let filter = Filter::new().kind(KIND_EMOJIS).limit(200); + let filter = Filter::new().kind(Kind::Emojis).limit(200); let mut events: Vec = client.database().query(filter).await?.into_iter().collect(); @@ -277,7 +274,7 @@ impl PersonRegistry { self.tasks.push(cx.background_spawn(async move { let opts = SubscribeAutoCloseOptions::default().exit_policy(ReqExitPolicy::ExitOnEOSE); - let filter = Filter::new().kind(KIND_EMOJIS).author(public_key).limit(1); + let filter = Filter::new().kind(Kind::Emojis).author(public_key).limit(1); if let Err(e) = client.subscribe(vec![filter]).close_on(opts).await { log::warn!("Failed to subscribe to emoji list: {e}");