From e20167333b0dc9688ee078ab811a61d4ab26f1c4 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Wed, 1 Apr 2026 09:52:43 +0700 Subject: [PATCH] . --- crates/chat/src/lib.rs | 4 ++++ crates/chat_ui/src/lib.rs | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/crates/chat/src/lib.rs b/crates/chat/src/lib.rs index fdc8442..bdf59ec 100644 --- a/crates/chat/src/lib.rs +++ b/crates/chat/src/lib.rs @@ -578,6 +578,10 @@ impl ChatRegistry { /// Reset the registry. pub fn reset(&mut self, cx: &mut Context) { self.rooms.clear(); + self.trashes.update(cx, |this, cx| { + this.clear(); + cx.notify(); + }); cx.notify(); } diff --git a/crates/chat_ui/src/lib.rs b/crates/chat_ui/src/lib.rs index e81de04..15c374d 100644 --- a/crates/chat_ui/src/lib.rs +++ b/crates/chat_ui/src/lib.rs @@ -471,6 +471,12 @@ impl ChatPanel { self.reports_by_id.read(cx).get(id).is_some() } + /// Check if a message was encrypted by the dekey + fn encrypted_by_dekey(&self, id: &EventId, cx: &App) -> bool { + let chat = ChatRegistry::global(cx); + chat.read(cx).encrypted_by_dekey(id) + } + /// Get all sent reports for a message by its ID fn sent_reports(&self, id: &EventId, cx: &App) -> Option> { self.reports_by_id.read(cx).get(id).cloned() @@ -843,6 +849,7 @@ impl ChatPanel { let replies = message.replies_to.as_slice(); let has_replies = !replies.is_empty(); let has_reports = self.has_reports(&id, cx); + let encrypted_by_dekey = self.encrypted_by_dekey(&id, cx); // Hide avatar setting let hide_avatar = AppSettings::get_hide_avatar(cx); @@ -888,6 +895,17 @@ impl ChatPanel { .text_color(cx.theme().text) .child(author.name()), ) + .when(encrypted_by_dekey, |this| { + this.child( + Button::new(format!("dekey-{ix}")) + .icon(IconName::Shield) + .ghost() + .xsmall() + .px_4() + .tooltip("Encrypted by Dekey") + .disabled(true), + ) + }) .child(message.created_at.to_human_time()) .when(has_reports, |this| { this.child(deferred(self.render_sent_reports(&id, cx)))