From b834510be0995b364aab08ba2331a4810b0e73a5 Mon Sep 17 00:00:00 2001 From: Akseli Lahtinen Date: Sat, 4 Jun 2022 04:19:19 +0300 Subject: [PATCH] Don't show notifications if application is active and same room is active --- src/roomlistmodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/roomlistmodel.cpp b/src/roomlistmodel.cpp index cf8108dac..1b0b47dc9 100644 --- a/src/roomlistmodel.cpp +++ b/src/roomlistmodel.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include "csapi/notifications.h" @@ -225,7 +226,9 @@ void RoomListModel::handleNotifications() } oldNotifications += notification["event"].toObject()["event_id"].toString(); auto room = m_connection->room(notification["room_id"].toString()); - if (room) { + + // If room exists, room is NOT active OR the application is NOT active, show notification + if (room && !(room->id() == RoomManager::instance().currentRoom()->id() && QGuiApplication::applicationState() == Qt::ApplicationActive)) { // The room might have been deleted (for example rejected invitation). auto sender = room->user(notification["event"].toObject()["sender"].toString());