Don't show notifications if application is active and same room is active

This commit is contained in:
Akseli Lahtinen
2022-06-04 04:19:19 +03:00
committed by Tobias Fella
parent 8700611235
commit b834510be0

View File

@@ -20,6 +20,7 @@
#include <QStandardPaths>
#include <KLocalizedString>
#include <QGuiApplication>
#include <utility>
#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());