Show non-admin context menu items for all channel members
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
c7c220309d
commit
7b6c0c539c
1 changed files with 43 additions and 38 deletions
|
@ -1923,7 +1923,6 @@ impl CollabPanel {
|
||||||
channel_id: u64,
|
channel_id: u64,
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) {
|
) {
|
||||||
if self.channel_store.read(cx).is_user_admin(channel_id) {
|
|
||||||
self.context_menu_on_selected = position.is_none();
|
self.context_menu_on_selected = position.is_none();
|
||||||
|
|
||||||
self.context_menu.update(cx, |context_menu, cx| {
|
self.context_menu.update(cx, |context_menu, cx| {
|
||||||
|
@ -1939,6 +1938,24 @@ impl CollabPanel {
|
||||||
"Collapse Subchannels"
|
"Collapse Subchannels"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut items = vec![
|
||||||
|
ContextMenuItem::action(expand_action_name, ToggleCollapse { channel_id }),
|
||||||
|
ContextMenuItem::action("Open Notes", OpenChannelBuffer { channel_id }),
|
||||||
|
];
|
||||||
|
|
||||||
|
if self.channel_store.read(cx).is_user_admin(channel_id) {
|
||||||
|
items.extend([
|
||||||
|
ContextMenuItem::Separator,
|
||||||
|
ContextMenuItem::action("New Subchannel", NewChannel { channel_id }),
|
||||||
|
ContextMenuItem::action("Rename", RenameChannel { channel_id }),
|
||||||
|
ContextMenuItem::Separator,
|
||||||
|
ContextMenuItem::action("Invite Members", InviteMembers { channel_id }),
|
||||||
|
ContextMenuItem::action("Manage Members", ManageMembers { channel_id }),
|
||||||
|
ContextMenuItem::Separator,
|
||||||
|
ContextMenuItem::action("Delete", RemoveChannel { channel_id }),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
context_menu.show(
|
context_menu.show(
|
||||||
position.unwrap_or_default(),
|
position.unwrap_or_default(),
|
||||||
if self.context_menu_on_selected {
|
if self.context_menu_on_selected {
|
||||||
|
@ -1946,25 +1963,13 @@ impl CollabPanel {
|
||||||
} else {
|
} else {
|
||||||
gpui::elements::AnchorCorner::BottomLeft
|
gpui::elements::AnchorCorner::BottomLeft
|
||||||
},
|
},
|
||||||
vec![
|
items,
|
||||||
ContextMenuItem::action(expand_action_name, ToggleCollapse { channel_id }),
|
|
||||||
ContextMenuItem::action("New Subchannel", NewChannel { channel_id }),
|
|
||||||
ContextMenuItem::action("Open Notes", OpenChannelBuffer { channel_id }),
|
|
||||||
ContextMenuItem::Separator,
|
|
||||||
ContextMenuItem::action("Invite to Channel", InviteMembers { channel_id }),
|
|
||||||
ContextMenuItem::Separator,
|
|
||||||
ContextMenuItem::action("Rename", RenameChannel { channel_id }),
|
|
||||||
ContextMenuItem::action("Manage", ManageMembers { channel_id }),
|
|
||||||
ContextMenuItem::Separator,
|
|
||||||
ContextMenuItem::action("Delete", RemoveChannel { channel_id }),
|
|
||||||
],
|
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
|
fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
|
||||||
if self.take_editing_state(cx) {
|
if self.take_editing_state(cx) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue