Open chat panel for guests

This commit is contained in:
Conrad Irwin 2024-01-12 10:34:24 -07:00
parent dc158f708f
commit f0d490c671
3 changed files with 12 additions and 4 deletions

View file

@ -442,8 +442,10 @@ impl ActiveCall {
.location .location
.as_ref() .as_ref()
.and_then(|location| location.upgrade()); .and_then(|location| location.upgrade());
let channel_id = room.update(cx, |room, cx| room.channel_id()); let (channel_id, role) = room.update(cx, |room, _| {
cx.emit(Event::RoomJoined { channel_id }); (room.channel_id(), room.local_participant().role)
});
cx.emit(Event::RoomJoined { channel_id, role });
room.update(cx, |room, cx| room.set_location(location.as_ref(), cx)) room.update(cx, |room, cx| room.set_location(location.as_ref(), cx))
} }
} else { } else {

View file

@ -28,6 +28,7 @@ pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30);
pub enum Event { pub enum Event {
RoomJoined { RoomJoined {
channel_id: Option<u64>, channel_id: Option<u64>,
role: proto::ChannelRole,
}, },
ParticipantLocationChanged { ParticipantLocationChanged {
participant_id: proto::PeerId, participant_id: proto::PeerId,

View file

@ -16,6 +16,7 @@ use menu::Confirm;
use message_editor::MessageEditor; use message_editor::MessageEditor;
use project::Fs; use project::Fs;
use rich_text::RichText; use rich_text::RichText;
use rpc::proto;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsStore}; use settings::{Settings, SettingsStore};
use std::sync::Arc; use std::sync::Arc;
@ -143,10 +144,14 @@ impl ChatPanel {
this.subscriptions.push(cx.subscribe( this.subscriptions.push(cx.subscribe(
&ActiveCall::global(cx), &ActiveCall::global(cx),
move |this: &mut Self, _, event: &room::Event, cx| match event { move |this: &mut Self, _, event: &room::Event, cx| match event {
room::Event::RoomJoined { channel_id } => { room::Event::RoomJoined { channel_id, role } => {
if let Some(channel_id) = channel_id { if let Some(channel_id) = channel_id {
this.select_channel(*channel_id, None, cx) this.select_channel(*channel_id, None, cx)
.detach_and_log_err(cx) .detach_and_log_err(cx);
if *role == proto::ChannelRole::Guest {
cx.emit(PanelEvent::Activate)
}
} }
} }
_ => {} _ => {}