revert single channel click (#7738)
- Revert "collab tweaks (#7706)" - Revert "2112 (#7640)" - Revert "single click channel (#7596)" - Reserve protobufs - Don't revert migrations Release Notes: - N/A **or** - N/A
This commit is contained in:
parent
ecd9b93cb1
commit
2294d99046
26 changed files with 525 additions and 709 deletions
|
@ -762,7 +762,6 @@ impl Pane {
|
|||
save_intent: SaveIntent,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Task<Result<()>> {
|
||||
println!("{}", std::backtrace::Backtrace::force_capture());
|
||||
self.close_items(cx, save_intent, move |view_id| view_id == item_id_to_close)
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ mod toolbar;
|
|||
mod workspace_settings;
|
||||
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use call::ActiveCall;
|
||||
use call::{call_settings::CallSettings, ActiveCall};
|
||||
use client::{
|
||||
proto::{self, ErrorCode, PeerId},
|
||||
Client, ErrorExt, Status, TypedEnvelope, UserStore,
|
||||
|
@ -1217,9 +1217,7 @@ impl Workspace {
|
|||
if let Some(active_call) = active_call {
|
||||
if !quitting
|
||||
&& workspace_count == 1
|
||||
&& active_call.read_with(&cx, |call, cx| {
|
||||
call.room().is_some_and(|room| room.read(cx).in_call())
|
||||
})?
|
||||
&& active_call.read_with(&cx, |call, _| call.room().is_some())?
|
||||
{
|
||||
let answer = window.update(&mut cx, |_, cx| {
|
||||
cx.prompt(
|
||||
|
@ -1232,11 +1230,12 @@ impl Workspace {
|
|||
|
||||
if answer.await.log_err() == Some(1) {
|
||||
return anyhow::Ok(false);
|
||||
} else {
|
||||
active_call
|
||||
.update(&mut cx, |call, cx| call.hang_up(cx))?
|
||||
.await
|
||||
.log_err();
|
||||
}
|
||||
active_call
|
||||
.update(&mut cx, |call, cx| call.hang_up(cx))?
|
||||
.await
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3999,6 +3998,8 @@ pub async fn last_opened_workspace_paths() -> Option<WorkspaceLocation> {
|
|||
DB.last_workspace().await.log_err().flatten()
|
||||
}
|
||||
|
||||
actions!(collab, [OpenChannelNotes]);
|
||||
|
||||
async fn join_channel_internal(
|
||||
channel_id: u64,
|
||||
app_state: &Arc<AppState>,
|
||||
|
@ -4100,6 +4101,36 @@ async fn join_channel_internal(
|
|||
return Some(join_remote_project(project, host, app_state.clone(), cx));
|
||||
}
|
||||
|
||||
// if you are the first to join a channel, share your project
|
||||
if room.remote_participants().len() == 0 && !room.local_participant_is_guest() {
|
||||
if let Some(workspace) = requesting_window {
|
||||
let project = workspace.update(cx, |workspace, cx| {
|
||||
if !CallSettings::get_global(cx).share_on_join {
|
||||
return None;
|
||||
}
|
||||
let project = workspace.project.read(cx);
|
||||
if project.is_local()
|
||||
&& project.visible_worktrees(cx).any(|tree| {
|
||||
tree.read(cx)
|
||||
.root_entry()
|
||||
.map_or(false, |entry| entry.is_dir())
|
||||
})
|
||||
{
|
||||
Some(workspace.project.clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
if let Ok(Some(project)) = project {
|
||||
return Some(cx.spawn(|room, mut cx| async move {
|
||||
room.update(&mut cx, |room, cx| room.share_project(project, cx))?
|
||||
.await?;
|
||||
Ok(())
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
})?;
|
||||
if let Some(task) = task {
|
||||
|
@ -4109,7 +4140,7 @@ async fn join_channel_internal(
|
|||
anyhow::Ok(false)
|
||||
}
|
||||
|
||||
pub fn open_channel(
|
||||
pub fn join_channel(
|
||||
channel_id: u64,
|
||||
app_state: Arc<AppState>,
|
||||
requesting_window: Option<WindowHandle<Workspace>>,
|
||||
|
@ -4142,6 +4173,12 @@ pub fn open_channel(
|
|||
})?
|
||||
.await?;
|
||||
|
||||
if result.is_ok() {
|
||||
cx.update(|cx| {
|
||||
cx.dispatch_action(&OpenChannelNotes);
|
||||
}).log_err();
|
||||
}
|
||||
|
||||
active_window = Some(window_handle);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue