BlueGit

ict rusty-teams

feat(channels): Manage team in the team menu

- team "..." menu: Manage team before Copy link
- deviation: opens the team in Teams on the web instead of Teams' Manage team page
- not built: Leave team (MT PUT beta/teams/{id}/members DemotedAndLeft, write not verifiable), Add channel, Add member, Manage tags (writes, owner rights, no member role in our sidebar)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-04 · 3 weeks ago

Hash
e8895ea568d0cea4ae6e7770a4cc16b890b94285
Parent
d62843d5
2 files changed +11 −2
crates/app-state/src/channel_menu.rs +9 −2
@@ -23,6 +23,7 @@ pub enum ChannelMenuItem {
23 23 pub enum TeamMenuItem {
24 24 Show,
25 25 Hide,
26 ManageTeam,
26 27 CopyLink,
27 28 }
28 29
@@ -51,6 +52,7 @@ impl TeamMenuItem {
51 52 match self {
52 53 TeamMenuItem::Show => "Show",
53 54 TeamMenuItem::Hide => "Hide",
55 TeamMenuItem::ManageTeam => "Manage team",
54 56 TeamMenuItem::CopyLink => "Copy link",
55 57 }
56 58 }
@@ -110,6 +112,7 @@ pub fn team_menu_entries(hidden: bool) -> Vec<MenuEntry<TeamMenuItem>> {
110 112 TeamMenuItem::Hide
111 113 }),
112 114 MenuEntry::Separator,
115 MenuEntry::Item(TeamMenuItem::ManageTeam),
113 116 MenuEntry::Item(TeamMenuItem::CopyLink),
114 117 ]
115 118 }
@@ -307,6 +310,10 @@ impl AppState {
307 310 self.with_team_link(team_id, LinkUse::Copy, cx);
308 311 }
309 312
313 pub fn manage_team_in_browser(&mut self, team_id: &str, cx: &mut Context<Self>) {
314 self.with_team_link(team_id, LinkUse::OpenInBrowser, cx);
315 }
316
310 317 fn with_team_link(&mut self, team_id: &str, link_use: LinkUse, cx: &mut Context<Self>) {
311 318 let Some(engine) = self.engine.clone() else {
312 319 if self.mode.demo {
@@ -459,11 +466,11 @@ mod tests {
459 466 fn team_menu_switches_between_show_and_hide() {
460 467 assert_eq!(
461 468 labels(&team_menu_entries(false), TeamMenuItem::label),
462 ["Hide", "-", "Copy link"]
469 ["Hide", "-", "Manage team", "Copy link"]
463 470 );
464 471 assert_eq!(
465 472 labels(&team_menu_entries(true), TeamMenuItem::label),
466 ["Show", "-", "Copy link"]
473 ["Show", "-", "Manage team", "Copy link"]
467 474 );
468 475 }
469 476
@@ -23,6 +23,7 @@ pub enum ChannelMenuItem {
23pub enum TeamMenuItem {
23pub enum TeamMenuItem {
24 Show,
24 Show,
25 Hide,
25 Hide,
26 ManageTeam,
26 CopyLink,
27 CopyLink,
27}
28}
28
29
@@ -51,6 +52,7 @@ impl TeamMenuItem {
51 match self {
52 match self {
52 TeamMenuItem::Show => "Show",
53 TeamMenuItem::Show => "Show",
53 TeamMenuItem::Hide => "Hide",
54 TeamMenuItem::Hide => "Hide",
55 TeamMenuItem::ManageTeam => "Manage team",
54 TeamMenuItem::CopyLink => "Copy link",
56 TeamMenuItem::CopyLink => "Copy link",
55 }
57 }
56 }
58 }
@@ -110,6 +112,7 @@ pub fn team_menu_entries(hidden: bool) -> Vec<MenuEntry<TeamMenuItem>> {
110 TeamMenuItem::Hide
112 TeamMenuItem::Hide
111 }),
113 }),
112 MenuEntry::Separator,
114 MenuEntry::Separator,
115 MenuEntry::Item(TeamMenuItem::ManageTeam),
113 MenuEntry::Item(TeamMenuItem::CopyLink),
116 MenuEntry::Item(TeamMenuItem::CopyLink),
114 ]
117 ]
115}
118}
@@ -307,6 +310,10 @@ impl AppState {
307 self.with_team_link(team_id, LinkUse::Copy, cx);
310 self.with_team_link(team_id, LinkUse::Copy, cx);
308 }
311 }
309
312
313 pub fn manage_team_in_browser(&mut self, team_id: &str, cx: &mut Context<Self>) {
314 self.with_team_link(team_id, LinkUse::OpenInBrowser, cx);
315 }
316
310 fn with_team_link(&mut self, team_id: &str, link_use: LinkUse, cx: &mut Context<Self>) {
317 fn with_team_link(&mut self, team_id: &str, link_use: LinkUse, cx: &mut Context<Self>) {
311 let Some(engine) = self.engine.clone() else {
318 let Some(engine) = self.engine.clone() else {
312 if self.mode.demo {
319 if self.mode.demo {
@@ -459,11 +466,11 @@ mod tests {
459 fn team_menu_switches_between_show_and_hide() {
466 fn team_menu_switches_between_show_and_hide() {
460 assert_eq!(
467 assert_eq!(
461 labels(&team_menu_entries(false), TeamMenuItem::label),
468 labels(&team_menu_entries(false), TeamMenuItem::label),
462 ["Hide", "-", "Copy link"]
469 ["Hide", "-", "Manage team", "Copy link"]
463 );
470 );
464 assert_eq!(
471 assert_eq!(
465 labels(&team_menu_entries(true), TeamMenuItem::label),
472 labels(&team_menu_entries(true), TeamMenuItem::label),
466 ["Show", "-", "Copy link"]
473 ["Show", "-", "Manage team", "Copy link"]
467 );
474 );
468 }
475 }
469
476
crates/app/src/views/sidebar.rs +2 −0
@@ -1968,12 +1968,14 @@ fn team_menu(popup: PopupMenu, state: Entity<AppState>, team_id: &str, hidden: b
1968 1968 .icon(menu_icon(match item {
1969 1969 TeamMenuItem::Show => IconName::Eye,
1970 1970 TeamMenuItem::Hide => IconName::EyeOff,
1971 TeamMenuItem::ManageTeam => IconName::Settings,
1971 1972 TeamMenuItem::CopyLink => IconName::Link,
1972 1973 }))
1973 1974 .on_click(move |_, _, cx| {
1974 1975 action_state.update(cx, |state, cx| match item {
1975 1976 TeamMenuItem::Show => state.set_team_shown(&action_id, true, cx),
1976 1977 TeamMenuItem::Hide => state.set_team_shown(&action_id, false, cx),
1978 TeamMenuItem::ManageTeam => state.manage_team_in_browser(&action_id, cx),
1977 1979 TeamMenuItem::CopyLink => state.copy_team_link(&action_id, cx),
1978 1980 });
1979 1981 }),
@@ -1968,12 +1968,14 @@ fn team_menu(popup: PopupMenu, state: Entity<AppState>, team_id: &str, hidden: b
1968 .icon(menu_icon(match item {
1968 .icon(menu_icon(match item {
1969 TeamMenuItem::Show => IconName::Eye,
1969 TeamMenuItem::Show => IconName::Eye,
1970 TeamMenuItem::Hide => IconName::EyeOff,
1970 TeamMenuItem::Hide => IconName::EyeOff,
1971 TeamMenuItem::ManageTeam => IconName::Settings,
1971 TeamMenuItem::CopyLink => IconName::Link,
1972 TeamMenuItem::CopyLink => IconName::Link,
1972 }))
1973 }))
1973 .on_click(move |_, _, cx| {
1974 .on_click(move |_, _, cx| {
1974 action_state.update(cx, |state, cx| match item {
1975 action_state.update(cx, |state, cx| match item {
1975 TeamMenuItem::Show => state.set_team_shown(&action_id, true, cx),
1976 TeamMenuItem::Show => state.set_team_shown(&action_id, true, cx),
1976 TeamMenuItem::Hide => state.set_team_shown(&action_id, false, cx),
1977 TeamMenuItem::Hide => state.set_team_shown(&action_id, false, cx),
1978 TeamMenuItem::ManageTeam => state.manage_team_in_browser(&action_id, cx),
1977 TeamMenuItem::CopyLink => state.copy_team_link(&action_id, cx),
1979 TeamMenuItem::CopyLink => state.copy_team_link(&action_id, cx),
1978 });
1980 });
1979 }),
1981 }),