Add remove channel method

Move test client fields into appstate and fix tests

Co-authored-by: max <max@zed.dev>
This commit is contained in:
Mikayla Maki
2023-08-01 16:06:27 -07:00
co-authored by max
parent 56d4d5d1a8
commit 74437b3988
15 changed files with 534 additions and 256 deletions
+12
View File
@@ -51,6 +51,10 @@ impl ChannelStore {
&self.channel_invitations
}
pub fn channel_for_id(&self, channel_id: u64) -> Option<Arc<Channel>> {
self.channels.iter().find(|c| c.id == channel_id).cloned()
}
pub fn create_channel(
&self,
name: &str,
@@ -103,6 +107,14 @@ impl ChannelStore {
false
}
pub fn remove_channel(&self, channel_id: u64) -> impl Future<Output = Result<()>> {
let client = self.client.clone();
async move {
client.request(proto::RemoveChannel { channel_id }).await?;
Ok(())
}
}
pub fn remove_member(
&self,
channel_id: u64,
+4 -1
View File
@@ -575,7 +575,10 @@ impl Client {
}),
);
if prev_handler.is_some() {
panic!("registered handler for the same message twice");
panic!(
"registered handler for the same message {} twice",
std::any::type_name::<M>()
);
}
Subscription::Message {