Dial in the channel creating/renaming UI

* Ensure channel list is in a consistent state with no flicker while the
  channel creation / rename request is outstanding.
* Maintain selection properly when renaming and creating channels.
* Style the channel name editor more consistently with the non-editable
  channel names.

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Max Brunsfeld
2023-08-09 17:11:57 -07:00
co-authored by Mikayla
parent 076b72cf2b
commit b3447ada27
8 changed files with 260 additions and 110 deletions
+16 -12
View File
@@ -2146,16 +2146,18 @@ async fn create_channel(
.create_channel(&request.name, parent_id, &live_kit_room, session.user_id)
.await?;
response.send(proto::CreateChannelResponse {
channel_id: id.to_proto(),
})?;
let mut update = proto::UpdateChannels::default();
update.channels.push(proto::Channel {
let channel = proto::Channel {
id: id.to_proto(),
name: request.name,
parent_id: request.parent_id,
});
};
response.send(proto::ChannelResponse {
channel: Some(channel.clone()),
})?;
let mut update = proto::UpdateChannels::default();
update.channels.push(channel);
let user_ids_to_notify = if let Some(parent_id) = parent_id {
db.get_channel_members(parent_id).await?
@@ -2317,14 +2319,16 @@ async fn rename_channel(
.rename_channel(channel_id, session.user_id, &request.name)
.await?;
response.send(proto::Ack {})?;
let mut update = proto::UpdateChannels::default();
update.channels.push(proto::Channel {
let channel = proto::Channel {
id: request.channel_id,
name: new_name,
parent_id: None,
});
};
response.send(proto::ChannelResponse {
channel: Some(channel.clone()),
})?;
let mut update = proto::UpdateChannels::default();
update.channels.push(channel);
let member_ids = db.get_channel_members(channel_id).await?;
+2 -2
View File
@@ -278,8 +278,8 @@ impl TestServer {
let channel_id = admin_client
.app_state
.channel_store
.update(admin_cx, |channel_store, _| {
channel_store.create_channel(channel, None)
.update(admin_cx, |channel_store, cx| {
channel_store.create_channel(channel, None, cx)
})
.await
.unwrap();
+8 -8
View File
@@ -21,15 +21,15 @@ async fn test_core_channels(
let channel_a_id = client_a
.channel_store()
.update(cx_a, |channel_store, _| {
channel_store.create_channel("channel-a", None)
.update(cx_a, |channel_store, cx| {
channel_store.create_channel("channel-a", None, cx)
})
.await
.unwrap();
let channel_b_id = client_a
.channel_store()
.update(cx_a, |channel_store, _| {
channel_store.create_channel("channel-b", Some(channel_a_id))
.update(cx_a, |channel_store, cx| {
channel_store.create_channel("channel-b", Some(channel_a_id), cx)
})
.await
.unwrap();
@@ -150,8 +150,8 @@ async fn test_core_channels(
let channel_c_id = client_a
.channel_store()
.update(cx_a, |channel_store, _| {
channel_store.create_channel("channel-c", Some(channel_b_id))
.update(cx_a, |channel_store, cx| {
channel_store.create_channel("channel-c", Some(channel_b_id), cx)
})
.await
.unwrap();
@@ -351,8 +351,8 @@ async fn test_joining_channel_ancestor_member(
let sub_id = client_a
.channel_store()
.update(cx_a, |channel_store, _| {
channel_store.create_channel("sub_channel", Some(parent_id))
.update(cx_a, |channel_store, cx| {
channel_store.create_channel("sub_channel", Some(parent_id), cx)
})
.await
.unwrap();