add NIP-29 groups to sidebar

This commit is contained in:
2026-09-30 15:09:23 +07:00
parent 41045d4f88
commit 6b068091c1
10 changed files with 111 additions and 385 deletions
+18 -1
View File
@@ -5,7 +5,7 @@ use anyhow::{Result, anyhow, bail};
use chat::Message;
use futures::io::AsyncReadExt;
use gpui::http_client::{AsyncBody, Builder, HttpRequestExt, Method, RedirectPolicy, StatusCode};
use gpui::{App, AppContext, Context, EventEmitter, Task};
use gpui::{App, AppContext, Context, EventEmitter, SharedString, Task};
use nostr::nips::nip98::{HttpData, HttpMethod};
use nostr_sdk::prelude::*;
use smallvec::{SmallVec, smallvec};
@@ -96,6 +96,23 @@ impl Group {
self.metadata.as_ref()
}
pub fn display_name(&self) -> SharedString {
let name = self
.metadata
.as_ref()
.and_then(|metadata| metadata.name())
.unwrap_or_else(|| self.key.id().as_str());
SharedString::from(name.to_owned())
}
pub fn display_image(&self) -> Option<SharedString> {
self.metadata
.as_ref()
.and_then(|metadata| metadata.picture.clone())
.map(SharedString::from)
}
pub fn members(&self) -> &GroupMembers {
&self.members
}