Fix channel drag and drop

Marshall Bowers and Max created

Also add the ability to unnest a channel by dragging it to the "Channels"
header. This is currently not working due to a collab server issue.

Co-authored-by: Max <max@zed.dev>

Change summary

crates/collab_ui2/src/collab_panel.rs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

Detailed changes

crates/collab_ui2/src/collab_panel.rs 🔗

@@ -2225,14 +2225,14 @@ impl CollabPanel {
                     .selected(is_selected),
             )
             .when(section == Section::Channels, |el| {
-                el.drag_over::<DraggedChannelView>(|style| {
+                el.drag_over::<Channel>(|style| {
                     style.bg(cx.theme().colors().ghost_element_hover)
                 })
                 .on_drop(cx.listener(
-                    move |this, view: &View<DraggedChannelView>, cx| {
+                    move |this, dragged_channel: &Channel, cx| {
                         this.channel_store
                             .update(cx, |channel_store, cx| {
-                                channel_store.move_channel(view.read(cx).channel.id, None, cx)
+                                channel_store.move_channel(dragged_channel.id, None, cx)
                             })
                             .detach_and_log_err(cx)
                     },
@@ -2451,15 +2451,15 @@ impl CollabPanel {
                     width,
                 })
             })
-            .drag_over::<DraggedChannelView>(|style| {
+            .drag_over::<Channel>(|style| {
                 style.bg(cx.theme().colors().ghost_element_hover)
             })
             .on_drop(
-                cx.listener(move |this, view: &View<DraggedChannelView>, cx| {
+                cx.listener(move |this, dragged_channel: &Channel, cx| {
                     this.channel_store
                         .update(cx, |channel_store, cx| {
                             channel_store.move_channel(
-                                view.read(cx).channel.id,
+                                dragged_channel.id,
                                 Some(channel_id),
                                 cx,
                             )