mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
wip
This commit is contained in:
parent
4a32bd6bb0
commit
ff822c9158
@ -513,13 +513,18 @@ async fn test_basic_chat(mut cx_a: TestAppContext, cx_b: TestAppContext) {
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
db.get_recent_channel_messages(channel_id, 50)
|
||||
.await
|
||||
.unwrap()[0]
|
||||
.body,
|
||||
"first message!"
|
||||
);
|
||||
|
||||
let channels_a = client_a.get_channels().await;
|
||||
assert_eq!(channels_a.len(), 1);
|
||||
assert_eq!(channels_a[0].read(&cx_a).name(), "test-channel");
|
||||
|
||||
// assert_eq!(
|
||||
// db.get_recent_channel_messages(channel_id, 50)
|
||||
// .await
|
||||
// .unwrap()[0]
|
||||
// .body,
|
||||
// "first message!"
|
||||
// );
|
||||
}
|
||||
|
||||
struct TestServer {
|
||||
|
31
zed/src/channel.rs
Normal file
31
zed/src/channel.rs
Normal file
@ -0,0 +1,31 @@
|
||||
use crate::rpc::Client;
|
||||
use gpui::{Entity, ModelHandle, WeakModelHandle};
|
||||
use std::{
|
||||
collections::{HashMap, VecDeque},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
pub struct ChannelList {
|
||||
channels: HashMap<u64, WeakModelHandle<Channel>>,
|
||||
rpc: Arc<Client>,
|
||||
}
|
||||
|
||||
pub struct Channel {
|
||||
id: u64,
|
||||
name: String,
|
||||
first_message_id: Option<u64>,
|
||||
messages: Option<VecDeque<ChannelMessage>>,
|
||||
rpc: Arc<Client>,
|
||||
}
|
||||
|
||||
pub struct ChannelMessage {
|
||||
id: u64,
|
||||
}
|
||||
|
||||
enum Event {}
|
||||
|
||||
impl Entity for ChannelList {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl ChannelList {}
|
@ -1,4 +1,5 @@
|
||||
pub mod assets;
|
||||
pub mod channel;
|
||||
pub mod editor;
|
||||
pub mod file_finder;
|
||||
pub mod fs;
|
||||
|
@ -29,6 +29,7 @@ pub struct Client {
|
||||
pub struct ClientState {
|
||||
connection_id: Option<ConnectionId>,
|
||||
pub shared_worktrees: HashMap<u64, WeakModelHandle<Worktree>>,
|
||||
pub channel_list: Option<WeakModelHandle<ChannelList>>,
|
||||
pub languages: Arc<LanguageRegistry>,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user