mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 03:25:59 +00:00
Never set a room on active call if it is offline
This commit is contained in:
parent
669406d5af
commit
e82320cde8
1 changed files with 14 additions and 10 deletions
|
@ -232,17 +232,21 @@ impl ActiveCall {
|
||||||
fn set_room(&mut self, room: Option<ModelHandle<Room>>, cx: &mut ModelContext<Self>) {
|
fn set_room(&mut self, room: Option<ModelHandle<Room>>, cx: &mut ModelContext<Self>) {
|
||||||
if room.as_ref() != self.room.as_ref().map(|room| &room.0) {
|
if room.as_ref() != self.room.as_ref().map(|room| &room.0) {
|
||||||
if let Some(room) = room {
|
if let Some(room) = room {
|
||||||
let subscriptions = vec![
|
if room.read(cx).status().is_offline() {
|
||||||
cx.observe(&room, |this, room, cx| {
|
self.room = None;
|
||||||
if room.read(cx).status().is_offline() {
|
} else {
|
||||||
this.set_room(None, cx);
|
let subscriptions = vec![
|
||||||
}
|
cx.observe(&room, |this, room, cx| {
|
||||||
|
if room.read(cx).status().is_offline() {
|
||||||
|
this.set_room(None, cx);
|
||||||
|
}
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}),
|
}),
|
||||||
cx.subscribe(&room, |_, _, event, cx| cx.emit(event.clone())),
|
cx.subscribe(&room, |_, _, event, cx| cx.emit(event.clone())),
|
||||||
];
|
];
|
||||||
self.room = Some((room, subscriptions));
|
self.room = Some((room, subscriptions));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.room = None;
|
self.room = None;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue