notifications: Show notifications for rooms other than the active one

Prior to this, we would only show notifications for sessions other than
the active one.
The expectation should be to have notifications for any room that is
not currently opened.
This commit is contained in:
Kévin Commaille 2023-11-30 11:55:18 +01:00
parent 23ccd87258
commit 66d3e84010
No known key found for this signature in database
GPG Key ID: 29A48C1F03620416
1 changed files with 9 additions and 4 deletions

View File

@ -116,10 +116,15 @@ impl Notifications {
let window = app.active_window().and_downcast::<Window>();
let session_id = session.session_id();
// Don't show notifications for the current session if the window is active.
if window
.is_some_and(|w| w.is_active() && w.current_session_id().as_deref() == Some(session_id))
{
// Don't show notifications for the current room in the current session if the
// window is active.
if window.is_some_and(|w| {
w.is_active()
&& w.current_session_id().as_deref() == Some(session_id)
&& w.session_view()
.selected_room()
.is_some_and(|r| r.room_id() == matrix_notification.room_id)
}) {
return;
}