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:
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user