Merge branch 'main' into allow-following-outside-of-projects

This commit is contained in:
Max Brunsfeld 2023-09-28 11:45:40 -07:00
commit a8b35eb8f5
147 changed files with 5383 additions and 1726 deletions

View file

@ -1,5 +1,5 @@
use anyhow::{anyhow, Result};
use call::ActiveCall;
use call::report_call_event_for_channel;
use channel::{Channel, ChannelBuffer, ChannelBufferEvent, ChannelId};
use client::{
proto::{self, PeerId},
@ -52,14 +52,9 @@ impl ChannelView {
cx.spawn(|mut cx| async move {
let channel_view = channel_view.await?;
pane.update(&mut cx, |pane, cx| {
let room_id = ActiveCall::global(cx)
.read(cx)
.room()
.map(|room| room.read(cx).id());
ActiveCall::report_call_event_for_room(
report_call_event_for_channel(
"open channel notes",
room_id,
Some(channel_id),
channel_id,
&workspace.read(cx).app_state().client,
cx,
);

View file

@ -136,6 +136,7 @@ actions!(
StartMoveChannel,
StartLinkChannel,
MoveOrLinkToSelected,
InsertSpace,
]
);
@ -184,6 +185,7 @@ pub fn init(cx: &mut AppContext) {
cx.add_action(CollabPanel::select_next);
cx.add_action(CollabPanel::select_prev);
cx.add_action(CollabPanel::confirm);
cx.add_action(CollabPanel::insert_space);
cx.add_action(CollabPanel::remove);
cx.add_action(CollabPanel::remove_selected_channel);
cx.add_action(CollabPanel::show_inline_context_menu);
@ -2518,6 +2520,14 @@ impl CollabPanel {
}
}
fn insert_space(&mut self, _: &InsertSpace, cx: &mut ViewContext<Self>) {
if self.channel_editing_state.is_some() {
self.channel_name_editor.update(cx, |editor, cx| {
editor.insert(" ", cx);
});
}
}
fn confirm_channel_edit(&mut self, cx: &mut ViewContext<CollabPanel>) -> bool {
if let Some(editing_state) = &mut self.channel_editing_state {
match editing_state {
@ -3054,6 +3064,19 @@ impl View for CollabPanel {
.on_click(MouseButton::Left, |_, _, cx| cx.focus_self())
.into_any_named("collab panel")
}
fn update_keymap_context(
&self,
keymap: &mut gpui::keymap_matcher::KeymapContext,
_: &AppContext,
) {
Self::reset_to_default_keymap_context(keymap);
if self.channel_editing_state.is_some() {
keymap.add_identifier("editing");
} else {
keymap.add_identifier("not_editing");
}
}
}
impl Panel for CollabPanel {

View file

@ -10,7 +10,7 @@ mod panel_settings;
mod project_shared_notification;
mod sharing_status_indicator;
use call::{ActiveCall, Room};
use call::{report_call_event_for_room, ActiveCall, Room};
use gpui::{
actions,
geometry::{
@ -55,18 +55,18 @@ pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
let client = call.client();
let toggle_screen_sharing = room.update(cx, |room, cx| {
if room.is_screen_sharing() {
ActiveCall::report_call_event_for_room(
report_call_event_for_room(
"disable screen share",
Some(room.id()),
room.id(),
room.channel_id(),
&client,
cx,
);
Task::ready(room.unshare_screen(cx))
} else {
ActiveCall::report_call_event_for_room(
report_call_event_for_room(
"enable screen share",
Some(room.id()),
room.id(),
room.channel_id(),
&client,
cx,
@ -83,23 +83,13 @@ pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {
if let Some(room) = call.room().cloned() {
let client = call.client();
room.update(cx, |room, cx| {
if room.is_muted(cx) {
ActiveCall::report_call_event_for_room(
"enable microphone",
Some(room.id()),
room.channel_id(),
&client,
cx,
);
let operation = if room.is_muted(cx) {
"enable microphone"
} else {
ActiveCall::report_call_event_for_room(
"disable microphone",
Some(room.id()),
room.channel_id(),
&client,
cx,
);
}
"disable microphone"
};
report_call_event_for_room(operation, room.id(), room.channel_id(), &client, cx);
room.toggle_mute(cx)
})
.map(|task| task.detach_and_log_err(cx))