Remove admin and member button

Fix bug with invites in the member list
Fix bug when there are network errors in the member related RPC calls

co-authored-by: Max <max@zed.dev>
This commit is contained in:
Mikayla 2023-08-07 14:32:09 -07:00
parent 90cdbe8bf3
commit 9913067e51
No known key found for this signature in database
4 changed files with 76 additions and 82 deletions

View file

@ -127,17 +127,21 @@ impl ChannelStore {
cx.notify();
let client = self.client.clone();
cx.spawn(|this, mut cx| async move {
client
let result = client
.request(proto::InviteChannelMember {
channel_id,
user_id,
admin,
})
.await?;
.await;
this.update(&mut cx, |this, cx| {
this.outgoing_invites.remove(&(channel_id, user_id));
cx.notify();
});
result?;
Ok(())
})
}
@ -155,16 +159,18 @@ impl ChannelStore {
cx.notify();
let client = self.client.clone();
cx.spawn(|this, mut cx| async move {
client
let result = client
.request(proto::RemoveChannelMember {
channel_id,
user_id,
})
.await?;
.await;
this.update(&mut cx, |this, cx| {
this.outgoing_invites.remove(&(channel_id, user_id));
cx.notify();
});
result?;
Ok(())
})
}
@ -183,17 +189,20 @@ impl ChannelStore {
cx.notify();
let client = self.client.clone();
cx.spawn(|this, mut cx| async move {
client
let result = client
.request(proto::SetChannelMemberAdmin {
channel_id,
user_id,
admin,
})
.await?;
.await;
this.update(&mut cx, |this, cx| {
this.outgoing_invites.remove(&(channel_id, user_id));
cx.notify();
});
result?;
Ok(())
})
}