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
|
@ -97,57 +97,11 @@ impl Database {
|
|||
.await
|
||||
}
|
||||
|
||||
pub async fn set_in_channel_call(
|
||||
&self,
|
||||
channel_id: ChannelId,
|
||||
user_id: UserId,
|
||||
in_call: bool,
|
||||
) -> Result<(proto::Room, ChannelRole)> {
|
||||
self.transaction(move |tx| async move {
|
||||
let channel = self.get_channel_internal(channel_id, &*tx).await?;
|
||||
let role = self.channel_role_for_user(&channel, user_id, &*tx).await?;
|
||||
if role.is_none() || role == Some(ChannelRole::Banned) {
|
||||
Err(ErrorCode::Forbidden.anyhow())?
|
||||
}
|
||||
let role = role.unwrap();
|
||||
|
||||
let Some(room) = room::Entity::find()
|
||||
.filter(room::Column::ChannelId.eq(channel_id))
|
||||
.one(&*tx)
|
||||
.await?
|
||||
else {
|
||||
Err(anyhow!("no room exists"))?
|
||||
};
|
||||
|
||||
let result = room_participant::Entity::update_many()
|
||||
.filter(
|
||||
Condition::all()
|
||||
.add(room_participant::Column::RoomId.eq(room.id))
|
||||
.add(room_participant::Column::UserId.eq(user_id)),
|
||||
)
|
||||
.set(room_participant::ActiveModel {
|
||||
in_call: ActiveValue::Set(in_call),
|
||||
..Default::default()
|
||||
})
|
||||
.exec(&*tx)
|
||||
.await?;
|
||||
|
||||
if result.rows_affected != 1 {
|
||||
Err(anyhow!("not in channel"))?
|
||||
}
|
||||
|
||||
let room = self.get_room(room.id, &*tx).await?;
|
||||
Ok((room, role))
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
/// Adds a user to the specified channel.
|
||||
pub async fn join_channel(
|
||||
&self,
|
||||
channel_id: ChannelId,
|
||||
user_id: UserId,
|
||||
autojoin: bool,
|
||||
connection: ConnectionId,
|
||||
environment: &str,
|
||||
) -> Result<(JoinRoom, Option<MembershipUpdated>, ChannelRole)> {
|
||||
|
@ -212,7 +166,7 @@ impl Database {
|
|||
.get_or_create_channel_room(channel_id, &live_kit_room, environment, &*tx)
|
||||
.await?;
|
||||
|
||||
self.join_channel_room_internal(room_id, user_id, autojoin, connection, role, &*tx)
|
||||
self.join_channel_room_internal(room_id, user_id, connection, role, &*tx)
|
||||
.await
|
||||
.map(|jr| (jr, accept_invite_result, role))
|
||||
})
|
||||
|
|
|
@ -135,7 +135,6 @@ impl Database {
|
|||
))),
|
||||
participant_index: ActiveValue::set(Some(0)),
|
||||
role: ActiveValue::set(Some(ChannelRole::Admin)),
|
||||
in_call: ActiveValue::set(true),
|
||||
|
||||
id: ActiveValue::NotSet,
|
||||
location_kind: ActiveValue::NotSet,
|
||||
|
@ -188,7 +187,6 @@ impl Database {
|
|||
))),
|
||||
initial_project_id: ActiveValue::set(initial_project_id),
|
||||
role: ActiveValue::set(Some(called_user_role)),
|
||||
in_call: ActiveValue::set(true),
|
||||
|
||||
id: ActiveValue::NotSet,
|
||||
answering_connection_id: ActiveValue::NotSet,
|
||||
|
@ -416,7 +414,6 @@ impl Database {
|
|||
&self,
|
||||
room_id: RoomId,
|
||||
user_id: UserId,
|
||||
autojoin: bool,
|
||||
connection: ConnectionId,
|
||||
role: ChannelRole,
|
||||
tx: &DatabaseTransaction,
|
||||
|
@ -440,8 +437,6 @@ impl Database {
|
|||
))),
|
||||
participant_index: ActiveValue::Set(Some(participant_index)),
|
||||
role: ActiveValue::set(Some(role)),
|
||||
in_call: ActiveValue::set(autojoin),
|
||||
|
||||
id: ActiveValue::NotSet,
|
||||
location_kind: ActiveValue::NotSet,
|
||||
location_project_id: ActiveValue::NotSet,
|
||||
|
@ -1263,7 +1258,6 @@ impl Database {
|
|||
location: Some(proto::ParticipantLocation { variant: location }),
|
||||
participant_index: participant_index as u32,
|
||||
role: db_participant.role.unwrap_or(ChannelRole::Member).into(),
|
||||
in_call: db_participant.in_call,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -20,7 +20,6 @@ pub struct Model {
|
|||
pub calling_connection_server_id: Option<ServerId>,
|
||||
pub participant_index: Option<i32>,
|
||||
pub role: Option<ChannelRole>,
|
||||
pub in_call: bool,
|
||||
}
|
||||
|
||||
impl Model {
|
||||
|
|
|
@ -138,7 +138,6 @@ async fn test_joining_channels(db: &Arc<Database>) {
|
|||
.join_channel(
|
||||
channel_1,
|
||||
user_1,
|
||||
false,
|
||||
ConnectionId { owner_id, id: 1 },
|
||||
TEST_RELEASE_CHANNEL,
|
||||
)
|
||||
|
@ -733,15 +732,9 @@ async fn test_guest_access(db: &Arc<Database>) {
|
|||
.await
|
||||
.is_err());
|
||||
|
||||
db.join_channel(
|
||||
zed_channel,
|
||||
guest,
|
||||
false,
|
||||
guest_connection,
|
||||
TEST_RELEASE_CHANNEL,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
db.join_channel(zed_channel, guest, guest_connection, TEST_RELEASE_CHANNEL)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(db
|
||||
.join_channel_chat(zed_channel, guest_connection, guest)
|
||||
|
|
|
@ -105,7 +105,6 @@ struct Session {
|
|||
zed_environment: Arc<str>,
|
||||
user_id: UserId,
|
||||
connection_id: ConnectionId,
|
||||
zed_version: SemanticVersion,
|
||||
db: Arc<tokio::sync::Mutex<DbHandle>>,
|
||||
peer: Arc<Peer>,
|
||||
connection_pool: Arc<parking_lot::Mutex<ConnectionPool>>,
|
||||
|
@ -132,19 +131,6 @@ impl Session {
|
|||
_not_send: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
fn endpoint_removed_in(&self, endpoint: &str, version: SemanticVersion) -> anyhow::Result<()> {
|
||||
if self.zed_version > version {
|
||||
Err(anyhow!(
|
||||
"{} was removed in {} (you're on {})",
|
||||
endpoint,
|
||||
version,
|
||||
self.zed_version
|
||||
))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Session {
|
||||
|
@ -288,11 +274,8 @@ impl Server {
|
|||
.add_request_handler(get_channel_members)
|
||||
.add_request_handler(respond_to_channel_invite)
|
||||
.add_request_handler(join_channel)
|
||||
.add_request_handler(join_channel2)
|
||||
.add_request_handler(join_channel_chat)
|
||||
.add_message_handler(leave_channel_chat)
|
||||
.add_request_handler(join_channel_call)
|
||||
.add_request_handler(leave_channel_call)
|
||||
.add_request_handler(send_channel_message)
|
||||
.add_request_handler(remove_channel_message)
|
||||
.add_request_handler(get_channel_messages)
|
||||
|
@ -576,7 +559,6 @@ impl Server {
|
|||
connection: Connection,
|
||||
address: String,
|
||||
user: User,
|
||||
zed_version: SemanticVersion,
|
||||
impersonator: Option<User>,
|
||||
mut send_connection_id: Option<oneshot::Sender<ConnectionId>>,
|
||||
executor: Executor,
|
||||
|
@ -634,7 +616,6 @@ impl Server {
|
|||
let session = Session {
|
||||
user_id,
|
||||
connection_id,
|
||||
zed_version,
|
||||
db: Arc::new(tokio::sync::Mutex::new(DbHandle(this.app_state.db.clone()))),
|
||||
zed_environment: this.app_state.config.zed_environment.clone(),
|
||||
peer: this.peer.clone(),
|
||||
|
@ -885,7 +866,7 @@ pub fn routes(server: Arc<Server>) -> Router<Body> {
|
|||
|
||||
pub async fn handle_websocket_request(
|
||||
TypedHeader(ProtocolVersion(protocol_version)): TypedHeader<ProtocolVersion>,
|
||||
app_version_header: Option<TypedHeader<AppVersionHeader>>,
|
||||
_app_version_header: Option<TypedHeader<AppVersionHeader>>,
|
||||
ConnectInfo(socket_address): ConnectInfo<SocketAddr>,
|
||||
Extension(server): Extension<Arc<Server>>,
|
||||
Extension(user): Extension<User>,
|
||||
|
@ -900,12 +881,6 @@ pub async fn handle_websocket_request(
|
|||
.into_response();
|
||||
}
|
||||
|
||||
// zed 0.122.x was the first version that sent an app header, so once that hits stable
|
||||
// we can return UPGRADE_REQUIRED instead of unwrap_or_default();
|
||||
let app_version = app_version_header
|
||||
.map(|header| header.0 .0)
|
||||
.unwrap_or_default();
|
||||
|
||||
let socket_address = socket_address.to_string();
|
||||
ws.on_upgrade(move |socket| {
|
||||
use util::ResultExt;
|
||||
|
@ -920,7 +895,6 @@ pub async fn handle_websocket_request(
|
|||
connection,
|
||||
socket_address,
|
||||
user,
|
||||
app_version,
|
||||
impersonator.0,
|
||||
None,
|
||||
Executor::Production,
|
||||
|
@ -1063,7 +1037,7 @@ async fn join_room(
|
|||
let channel_id = session.db().await.channel_id_for_room(room_id).await?;
|
||||
|
||||
if let Some(channel_id) = channel_id {
|
||||
return join_channel_internal(channel_id, true, Box::new(response), session).await;
|
||||
return join_channel_internal(channel_id, Box::new(response), session).await;
|
||||
}
|
||||
|
||||
let joined_room = {
|
||||
|
@ -2726,67 +2700,14 @@ async fn respond_to_channel_invite(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Join the channels' call
|
||||
/// Join the channels' room
|
||||
async fn join_channel(
|
||||
request: proto::JoinChannel,
|
||||
response: Response<proto::JoinChannel>,
|
||||
session: Session,
|
||||
) -> Result<()> {
|
||||
session.endpoint_removed_in("join_channel", "0.123.0".parse().unwrap())?;
|
||||
|
||||
let channel_id = ChannelId::from_proto(request.channel_id);
|
||||
join_channel_internal(channel_id, true, Box::new(response), session).await
|
||||
}
|
||||
|
||||
async fn join_channel2(
|
||||
request: proto::JoinChannel2,
|
||||
response: Response<proto::JoinChannel2>,
|
||||
session: Session,
|
||||
) -> Result<()> {
|
||||
let channel_id = ChannelId::from_proto(request.channel_id);
|
||||
join_channel_internal(channel_id, false, Box::new(response), session).await
|
||||
}
|
||||
|
||||
async fn join_channel_call(
|
||||
request: proto::JoinChannelCall,
|
||||
response: Response<proto::JoinChannelCall>,
|
||||
session: Session,
|
||||
) -> Result<()> {
|
||||
let channel_id = ChannelId::from_proto(request.channel_id);
|
||||
let db = session.db().await;
|
||||
let (joined_room, role) = db
|
||||
.set_in_channel_call(channel_id, session.user_id, true)
|
||||
.await?;
|
||||
|
||||
let Some(connection_info) = session.live_kit_client.as_ref().and_then(|live_kit| {
|
||||
live_kit_info_for_user(live_kit, &session.user_id, role, &joined_room.live_kit_room)
|
||||
}) else {
|
||||
Err(anyhow!("no live kit token info"))?
|
||||
};
|
||||
|
||||
room_updated(&joined_room, &session.peer);
|
||||
response.send(proto::JoinChannelCallResponse {
|
||||
live_kit_connection_info: Some(connection_info),
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn leave_channel_call(
|
||||
request: proto::LeaveChannelCall,
|
||||
response: Response<proto::LeaveChannelCall>,
|
||||
session: Session,
|
||||
) -> Result<()> {
|
||||
let channel_id = ChannelId::from_proto(request.channel_id);
|
||||
let db = session.db().await;
|
||||
let (joined_room, _) = db
|
||||
.set_in_channel_call(channel_id, session.user_id, false)
|
||||
.await?;
|
||||
|
||||
room_updated(&joined_room, &session.peer);
|
||||
response.send(proto::Ack {})?;
|
||||
|
||||
Ok(())
|
||||
join_channel_internal(channel_id, Box::new(response), session).await
|
||||
}
|
||||
|
||||
trait JoinChannelInternalResponse {
|
||||
|
@ -2802,15 +2723,9 @@ impl JoinChannelInternalResponse for Response<proto::JoinRoom> {
|
|||
Response::<proto::JoinRoom>::send(self, result)
|
||||
}
|
||||
}
|
||||
impl JoinChannelInternalResponse for Response<proto::JoinChannel2> {
|
||||
fn send(self, result: proto::JoinRoomResponse) -> Result<()> {
|
||||
Response::<proto::JoinChannel2>::send(self, result)
|
||||
}
|
||||
}
|
||||
|
||||
async fn join_channel_internal(
|
||||
channel_id: ChannelId,
|
||||
autojoin: bool,
|
||||
response: Box<impl JoinChannelInternalResponse>,
|
||||
session: Session,
|
||||
) -> Result<()> {
|
||||
|
@ -2822,22 +2737,39 @@ async fn join_channel_internal(
|
|||
.join_channel(
|
||||
channel_id,
|
||||
session.user_id,
|
||||
autojoin,
|
||||
session.connection_id,
|
||||
session.zed_environment.as_ref(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let live_kit_connection_info = session.live_kit_client.as_ref().and_then(|live_kit| {
|
||||
if !autojoin {
|
||||
return None;
|
||||
}
|
||||
live_kit_info_for_user(
|
||||
live_kit,
|
||||
&session.user_id,
|
||||
role,
|
||||
&joined_room.room.live_kit_room,
|
||||
)
|
||||
let (can_publish, token) = if role == ChannelRole::Guest {
|
||||
(
|
||||
false,
|
||||
live_kit
|
||||
.guest_token(
|
||||
&joined_room.room.live_kit_room,
|
||||
&session.user_id.to_string(),
|
||||
)
|
||||
.trace_err()?,
|
||||
)
|
||||
} else {
|
||||
(
|
||||
true,
|
||||
live_kit
|
||||
.room_token(
|
||||
&joined_room.room.live_kit_room,
|
||||
&session.user_id.to_string(),
|
||||
)
|
||||
.trace_err()?,
|
||||
)
|
||||
};
|
||||
|
||||
Some(LiveKitConnectionInfo {
|
||||
server_url: live_kit.url().into(),
|
||||
token,
|
||||
can_publish,
|
||||
})
|
||||
});
|
||||
|
||||
response.send(proto::JoinRoomResponse {
|
||||
|
@ -2873,35 +2805,6 @@ async fn join_channel_internal(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn live_kit_info_for_user(
|
||||
live_kit: &Arc<dyn live_kit_server::api::Client>,
|
||||
user_id: &UserId,
|
||||
role: ChannelRole,
|
||||
live_kit_room: &String,
|
||||
) -> Option<LiveKitConnectionInfo> {
|
||||
let (can_publish, token) = if role == ChannelRole::Guest {
|
||||
(
|
||||
false,
|
||||
live_kit
|
||||
.guest_token(live_kit_room, &user_id.to_string())
|
||||
.trace_err()?,
|
||||
)
|
||||
} else {
|
||||
(
|
||||
true,
|
||||
live_kit
|
||||
.room_token(live_kit_room, &user_id.to_string())
|
||||
.trace_err()?,
|
||||
)
|
||||
};
|
||||
|
||||
Some(LiveKitConnectionInfo {
|
||||
server_url: live_kit.url().into(),
|
||||
token,
|
||||
can_publish,
|
||||
})
|
||||
}
|
||||
|
||||
/// Start editing the channel notes
|
||||
async fn join_channel_buffer(
|
||||
request: proto::JoinChannelBuffer,
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
use crate::{
|
||||
db::ChannelId,
|
||||
tests::{test_server::join_channel_call, TestServer},
|
||||
};
|
||||
use crate::{db::ChannelId, tests::TestServer};
|
||||
use call::ActiveCall;
|
||||
use editor::Editor;
|
||||
use gpui::{BackgroundExecutor, TestAppContext};
|
||||
|
@ -35,7 +32,7 @@ async fn test_channel_guests(
|
|||
cx_a.executor().run_until_parked();
|
||||
|
||||
// Client B joins channel A as a guest
|
||||
cx_b.update(|cx| workspace::open_channel(channel_id, client_b.app_state.clone(), None, cx))
|
||||
cx_b.update(|cx| workspace::join_channel(channel_id, client_b.app_state.clone(), None, cx))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -75,7 +72,7 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
|||
.await;
|
||||
|
||||
let project_a = client_a.build_test_project(cx_a).await;
|
||||
cx_a.update(|cx| workspace::open_channel(channel_id, client_a.app_state.clone(), None, cx))
|
||||
cx_a.update(|cx| workspace::join_channel(channel_id, client_a.app_state.clone(), None, cx))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -87,13 +84,11 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
|||
cx_a.run_until_parked();
|
||||
|
||||
// Client B joins channel A as a guest
|
||||
cx_b.update(|cx| workspace::open_channel(channel_id, client_b.app_state.clone(), None, cx))
|
||||
cx_b.update(|cx| workspace::join_channel(channel_id, client_b.app_state.clone(), None, cx))
|
||||
.await
|
||||
.unwrap();
|
||||
cx_a.run_until_parked();
|
||||
|
||||
join_channel_call(cx_b).await.unwrap();
|
||||
|
||||
// client B opens 1.txt as a guest
|
||||
let (workspace_b, cx_b) = client_b.active_workspace(cx_b);
|
||||
let room_b = cx_b
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
db::{self, UserId},
|
||||
rpc::RECONNECT_TIMEOUT,
|
||||
tests::{room_participants, test_server::join_channel_call, RoomParticipants, TestServer},
|
||||
tests::{room_participants, RoomParticipants, TestServer},
|
||||
};
|
||||
use call::ActiveCall;
|
||||
use channel::{ChannelId, ChannelMembership, ChannelStore};
|
||||
|
@ -382,7 +382,6 @@ async fn test_channel_room(
|
|||
.update(cx_a, |active_call, cx| active_call.join_channel(zed_id, cx))
|
||||
.await
|
||||
.unwrap();
|
||||
join_channel_call(cx_a).await.unwrap();
|
||||
|
||||
// Give everyone a chance to observe user A joining
|
||||
executor.run_until_parked();
|
||||
|
@ -430,7 +429,7 @@ async fn test_channel_room(
|
|||
.update(cx_b, |active_call, cx| active_call.join_channel(zed_id, cx))
|
||||
.await
|
||||
.unwrap();
|
||||
join_channel_call(cx_b).await.unwrap();
|
||||
|
||||
executor.run_until_parked();
|
||||
|
||||
cx_a.read(|cx| {
|
||||
|
@ -553,9 +552,6 @@ async fn test_channel_room(
|
|||
.await
|
||||
.unwrap();
|
||||
|
||||
join_channel_call(cx_a).await.unwrap();
|
||||
join_channel_call(cx_b).await.unwrap();
|
||||
|
||||
executor.run_until_parked();
|
||||
|
||||
let room_a =
|
||||
|
|
|
@ -24,7 +24,7 @@ use workspace::{
|
|||
|
||||
use super::TestClient;
|
||||
|
||||
#[gpui::test]
|
||||
#[gpui::test(iterations = 10)]
|
||||
async fn test_basic_following(
|
||||
cx_a: &mut TestAppContext,
|
||||
cx_b: &mut TestAppContext,
|
||||
|
@ -437,7 +437,6 @@ async fn test_basic_following(
|
|||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
executor.run_until_parked();
|
||||
let shared_screen = workspace_a.update(cx_a, |workspace, cx| {
|
||||
workspace
|
||||
|
@ -523,7 +522,6 @@ async fn test_basic_following(
|
|||
workspace_a.update(cx_a, |workspace, _| workspace.leader_for_pane(&pane_a)),
|
||||
None
|
||||
);
|
||||
executor.run_until_parked();
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -2006,7 +2004,7 @@ async fn join_channel(
|
|||
client: &TestClient,
|
||||
cx: &mut TestAppContext,
|
||||
) -> anyhow::Result<()> {
|
||||
cx.update(|cx| workspace::open_channel(channel_id, client.app_state.clone(), None, cx))
|
||||
cx.update(|cx| workspace::join_channel(channel_id, client.app_state.clone(), None, cx))
|
||||
.await
|
||||
}
|
||||
|
||||
|
|
|
@ -1881,7 +1881,7 @@ fn active_call_events(cx: &mut TestAppContext) -> Rc<RefCell<Vec<room::Event>>>
|
|||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_mute(
|
||||
async fn test_mute_deafen(
|
||||
executor: BackgroundExecutor,
|
||||
cx_a: &mut TestAppContext,
|
||||
cx_b: &mut TestAppContext,
|
||||
|
@ -1920,7 +1920,7 @@ async fn test_mute(
|
|||
room_a.read_with(cx_a, |room, _| assert!(!room.is_muted()));
|
||||
room_b.read_with(cx_b, |room, _| assert!(!room.is_muted()));
|
||||
|
||||
// Users A and B are both unmuted.
|
||||
// Users A and B are both muted.
|
||||
assert_eq!(
|
||||
participant_audio_state(&room_a, cx_a),
|
||||
&[ParticipantAudioState {
|
||||
|
@ -1962,6 +1962,30 @@ async fn test_mute(
|
|||
}]
|
||||
);
|
||||
|
||||
// User A deafens
|
||||
room_a.update(cx_a, |room, cx| room.toggle_deafen(cx));
|
||||
executor.run_until_parked();
|
||||
|
||||
// User A does not hear user B.
|
||||
room_a.read_with(cx_a, |room, _| assert!(room.is_muted()));
|
||||
room_b.read_with(cx_b, |room, _| assert!(!room.is_muted()));
|
||||
assert_eq!(
|
||||
participant_audio_state(&room_a, cx_a),
|
||||
&[ParticipantAudioState {
|
||||
user_id: client_b.user_id().unwrap(),
|
||||
is_muted: false,
|
||||
audio_tracks_playing: vec![false],
|
||||
}]
|
||||
);
|
||||
assert_eq!(
|
||||
participant_audio_state(&room_b, cx_b),
|
||||
&[ParticipantAudioState {
|
||||
user_id: client_a.user_id().unwrap(),
|
||||
is_muted: true,
|
||||
audio_tracks_playing: vec![true],
|
||||
}]
|
||||
);
|
||||
|
||||
// User B calls user C, C joins.
|
||||
active_call_b
|
||||
.update(cx_b, |call, cx| {
|
||||
|
@ -1976,6 +2000,22 @@ async fn test_mute(
|
|||
.unwrap();
|
||||
executor.run_until_parked();
|
||||
|
||||
// User A does not hear users B or C.
|
||||
assert_eq!(
|
||||
participant_audio_state(&room_a, cx_a),
|
||||
&[
|
||||
ParticipantAudioState {
|
||||
user_id: client_b.user_id().unwrap(),
|
||||
is_muted: false,
|
||||
audio_tracks_playing: vec![false],
|
||||
},
|
||||
ParticipantAudioState {
|
||||
user_id: client_c.user_id().unwrap(),
|
||||
is_muted: false,
|
||||
audio_tracks_playing: vec![false],
|
||||
}
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
participant_audio_state(&room_b, cx_b),
|
||||
&[
|
||||
|
|
|
@ -37,7 +37,7 @@ use std::{
|
|||
Arc,
|
||||
},
|
||||
};
|
||||
use util::{http::FakeHttpClient, SemanticVersion};
|
||||
use util::http::FakeHttpClient;
|
||||
use workspace::{Workspace, WorkspaceStore};
|
||||
|
||||
pub struct TestServer {
|
||||
|
@ -231,7 +231,6 @@ impl TestServer {
|
|||
server_conn,
|
||||
client_name,
|
||||
user,
|
||||
SemanticVersion::default(),
|
||||
None,
|
||||
Some(connection_id_tx),
|
||||
Executor::Deterministic(cx.background_executor().clone()),
|
||||
|
@ -687,7 +686,7 @@ impl TestClient {
|
|||
channel_id: u64,
|
||||
cx: &'a mut TestAppContext,
|
||||
) -> (View<Workspace>, &'a mut VisualTestContext) {
|
||||
cx.update(|cx| workspace::open_channel(channel_id, self.app_state.clone(), None, cx))
|
||||
cx.update(|cx| workspace::join_channel(channel_id, self.app_state.clone(), None, cx))
|
||||
.await
|
||||
.unwrap();
|
||||
cx.run_until_parked();
|
||||
|
@ -762,11 +761,6 @@ impl TestClient {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn join_channel_call(cx: &mut TestAppContext) -> Task<anyhow::Result<()>> {
|
||||
let room = cx.read(|cx| ActiveCall::global(cx).read(cx).room().cloned());
|
||||
room.unwrap().update(cx, |room, cx| room.join_call(cx))
|
||||
}
|
||||
|
||||
pub fn open_channel_notes(
|
||||
channel_id: u64,
|
||||
cx: &mut VisualTestContext,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue