collab ui: Dismiss project shared notifications when leaving room (#10160)

When leaving a call/room in which a project was shared, the shared
project notification was not getting dismissed when the person that
shared the project left the room.
Although there was a `cx.emit(Event::Left)` call inside room, the event
was never received in the `project_shared_notification` module, because
the room is dropped before the event can be dispatched. Moving the
`cx.emit(Event::Left)` to the active call fixed the problem. Also
renamed `Event::Left` to `Event::RoomLeft` because the room join
equivalent is also called `Event::RoomJoined`.


Release Notes:

- Fixed project shared notification staying open, when the user that
shared the project left the room
This commit is contained in:
Bennet Bo Fenner 2024-04-04 13:43:14 +02:00 committed by GitHub
parent 8e9543aefe
commit 5b4ff74dca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 6 deletions

View file

@ -373,7 +373,10 @@ impl ActiveCall {
self.report_call_event("hang up", cx);
Audio::end_call(cx);
let channel_id = self.channel_id(cx);
if let Some((room, _)) = self.room.take() {
cx.emit(Event::RoomLeft { channel_id });
room.update(cx, |room, cx| room.leave(cx))
} else {
Task::ready(Ok(()))

View file

@ -52,7 +52,7 @@ pub enum Event {
RemoteProjectInvitationDiscarded {
project_id: u64,
},
Left {
RoomLeft {
channel_id: Option<ChannelId>,
},
}
@ -366,9 +366,6 @@ impl Room {
pub(crate) fn leave(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
cx.notify();
cx.emit(Event::Left {
channel_id: self.channel_id(),
});
self.leave_internal(cx)
}