From affb3392377262c2d4beb37f6c80399cd76701aa Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Wed, 11 Mar 2026 08:46:36 +0700 Subject: [PATCH] remove connect verification in chat ui --- crates/chat_ui/src/lib.rs | 52 +-------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/crates/chat_ui/src/lib.rs b/crates/chat_ui/src/lib.rs index 227d874..9f82af8 100644 --- a/crates/chat_ui/src/lib.rs +++ b/crates/chat_ui/src/lib.rs @@ -1,6 +1,5 @@ use std::collections::{BTreeMap, BTreeSet, HashSet}; use std::sync::Arc; -use std::time::Duration; pub use actions::*; use anyhow::{Context as AnyhowContext, Error}; @@ -42,11 +41,6 @@ mod text; const ANNOUNCEMENT: &str = "This conversation is private. Only members can see each other's messages."; -const NO_INBOX: &str = "has not set up messaging relays. \ - They will not receive messages you send."; -const NO_ANNOUNCEMENT: &str = "has not set up an encryption key. \ - You cannot send messages encrypted with an encryption key to them yet. \ - Coop automatically uses your identity to encrypt messages."; pub fn init(room: WeakEntity, window: &mut Window, cx: &mut App) -> Entity { cx.new(|cx| ChatPanel::new(room, window, cx)) @@ -131,7 +125,7 @@ impl ChatPanel { }); // Define subject input state - let subject_input = cx.new(|cx| InputState::new(window, cx).placeholder("Nostr Meetup")); + let subject_input = cx.new(|cx| InputState::new(window, cx).placeholder("New subject...")); let subject_bar = cx.new(|_cx| false); // Define subscriptions @@ -161,7 +155,6 @@ impl ChatPanel { // Define all functions that will run after the current cycle cx.defer_in(window, |this, window, cx| { - this.connect(window, cx); this.handle_notifications(cx); this.subscribe_room_events(window, cx); this.get_messages(window, cx); @@ -187,49 +180,6 @@ impl ChatPanel { } } - /// Get all necessary data for each member - fn connect(&mut self, window: &mut Window, cx: &mut Context) { - let Ok((members, connect)) = self - .room - .read_with(cx, |this, cx| (this.members(), this.connect(cx))) - else { - return; - }; - - // Run the connect task in background - self.tasks.push(connect); - - // Spawn another task to verify after 3 seconds - self.tasks.push(cx.spawn_in(window, async move |this, cx| { - cx.background_executor().timer(Duration::from_secs(3)).await; - - // Verify the connection - this.update_in(cx, |this, _window, cx| { - let persons = PersonRegistry::global(cx); - - for member in members.into_iter() { - let profile = persons.read(cx).get(&member, cx); - - if profile.announcement().is_none() { - let content = format!("{} {}", profile.name(), NO_ANNOUNCEMENT); - let message = Message::warning(content); - - this.insert_message(message, true, cx); - } - - if profile.messaging_relays().is_empty() { - let content = format!("{} {}", profile.name(), NO_INBOX); - let message = Message::warning(content); - - this.insert_message(message, true, cx); - } - } - })?; - - Ok(()) - })); - } - /// Handle nostr notifications fn handle_notifications(&mut self, cx: &mut Context) { let nostr = NostrRegistry::global(cx);