.
This commit is contained in:
@@ -468,7 +468,15 @@ impl ChatRegistry {
|
|||||||
self.trashes.clone()
|
self.trashes.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the relays that have seen a given message.
|
/// Get the relays that have seen a given rumor id.
|
||||||
|
pub fn rumor_seen_on(&self, id: &EventId) -> Option<HashSet<RelayUrl>> {
|
||||||
|
self.event_map
|
||||||
|
.read_blocking()
|
||||||
|
.get(id)
|
||||||
|
.map(|id| self.seen_on(id))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the relays that have seen a given gift wrap id.
|
||||||
pub fn seen_on(&self, id: &EventId) -> HashSet<RelayUrl> {
|
pub fn seen_on(&self, id: &EventId) -> HashSet<RelayUrl> {
|
||||||
self.seens
|
self.seens
|
||||||
.read_blocking()
|
.read_blocking()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
pub use actions::*;
|
pub use actions::*;
|
||||||
use anyhow::{Context as AnyhowContext, Error};
|
use anyhow::{Context as AnyhowContext, Error};
|
||||||
use chat::{Message, RenderedMessage, Room, RoomEvent, SendReport, SendStatus};
|
use chat::{ChatRegistry, Message, RenderedMessage, Room, RoomEvent, SendReport, SendStatus};
|
||||||
use common::RenderedTimestamp;
|
use common::RenderedTimestamp;
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
@@ -665,9 +665,46 @@ impl ChatPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open_trace(&mut self, id: &EventId, window: &mut Window, cx: &mut Context<Self>) {
|
fn open_trace(&mut self, id: &EventId, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
|
let chat = ChatRegistry::global(cx);
|
||||||
|
let seen_on = chat.read(cx).rumor_seen_on(id);
|
||||||
|
|
||||||
window.open_modal(cx, move |this, _window, cx| {
|
window.open_modal(cx, move |this, _window, cx| {
|
||||||
// TODO
|
this.title("Seen on").show_close(true).child(
|
||||||
this.child(v_flex().child(""))
|
v_flex()
|
||||||
|
.gap_1()
|
||||||
|
.when_none(&seen_on, |this| {
|
||||||
|
this.child(
|
||||||
|
h_flex()
|
||||||
|
.h_10()
|
||||||
|
.justify_center()
|
||||||
|
.text_sm()
|
||||||
|
.bg(cx.theme().elevated_surface_background)
|
||||||
|
.rounded(cx.theme().radius)
|
||||||
|
.child("Message isn't traced yet"),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.when_some(seen_on.as_ref(), |this, relays| {
|
||||||
|
this.children({
|
||||||
|
let mut items = vec![];
|
||||||
|
|
||||||
|
for url in relays.iter() {
|
||||||
|
items.push(
|
||||||
|
h_flex()
|
||||||
|
.h_7()
|
||||||
|
.px_2()
|
||||||
|
.gap_2()
|
||||||
|
.bg(cx.theme().elevated_surface_background)
|
||||||
|
.rounded(cx.theme().radius)
|
||||||
|
.text_sm()
|
||||||
|
.child(div().size_1p5().rounded_full().bg(gpui::green()))
|
||||||
|
.child(SharedString::from(url.to_string())),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
items
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user