clean up
This commit is contained in:
@@ -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<PersonRegistry>);
|
||||
|
||||
impl Global for GlobalPersonRegistry {}
|
||||
@@ -58,9 +55,9 @@ impl PersonRegistry {
|
||||
|
||||
/// Create a new person registry instance
|
||||
fn new(cx: &mut Context<Self>) -> 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::<Dispatch>(100);
|
||||
@@ -238,7 +235,7 @@ impl PersonRegistry {
|
||||
type EmojiLists = Vec<(PublicKey, Vec<(String, Url)>)>;
|
||||
|
||||
let task: Task<Result<EmojiLists, Error>> = 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<Event> =
|
||||
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}");
|
||||
|
||||
Reference in New Issue
Block a user