gitdataai/lib/channel/event/common.rs
zhenyi 779e4eae2f feat(channel): add article feed and composer with room type support
- Add ArticleFeed component for article-based channels
- Implement ArticleComposer with draft persistence
- Add Newspaper icon for article room type
- Update ChannelPage to conditionally render article feed vs message view
- Add article-related API endpoints and models
- Reset thread view when switching rooms
- Add room type check in channel sidebar
- Update CSS to hide scrollbars globally
- Add gRPC message size limit configuration
- Fix git diff tree handling
2026-05-31 03:09:49 +08:00

75 lines
1.6 KiB
Rust

use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserInfo {
pub id: Uuid,
pub username: String,
pub display_name: String,
pub avatar_url: String,
}
impl UserInfo {
pub fn unknown(id: Uuid) -> Self {
Self {
id,
username: String::new(),
display_name: String::new(),
avatar_url: String::new(),
}
}
pub fn from_model(m: &model::users::UserModel) -> Self {
Self {
id: m.id,
username: m.username.clone(),
display_name: m.display_name.clone(),
avatar_url: m.avatar_url.clone(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RoomInfo {
pub id: Uuid,
pub name: String,
}
impl RoomInfo {
pub fn unknown(id: Uuid) -> Self {
Self {
id,
name: String::new(),
}
}
pub fn from_model(m: &model::channel::ChannelModel) -> Self {
Self {
id: m.id,
name: m.name.clone(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkspaceInfo {
pub id: Uuid,
pub name: String,
pub avatar_url: String,
}
impl WorkspaceInfo {
pub fn unknown(id: Uuid) -> Self {
Self {
id,
name: String::new(),
avatar_url: String::new(),
}
}
pub fn from_model(m: &model::workspace::WorkspaceModel) -> Self {
Self {
id: m.id,
name: m.name.clone(),
avatar_url: m.avatar_url.clone(),
}
}
}