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:21 -07:00
parent 56d4d5d1a8
commit 74437b3988
No known key found for this signature in database
15 changed files with 534 additions and 256 deletions

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,