mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 13:55:47 +03:00
follow shouldNotify flag to hide notifications when needed
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
5e505d9ee3
commit
e0bdbd1387
3 changed files with 14 additions and 0 deletions
|
@ -157,6 +157,7 @@ public:
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool _shouldNotify = true;
|
||||||
|
|
||||||
[[nodiscard]] Identifier ident() const;
|
[[nodiscard]] Identifier ident() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -105,6 +105,10 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (json.contains("shouldNotify")) {
|
||||||
|
a._shouldNotify = json.value("shouldNotify").toBool(true);
|
||||||
|
}
|
||||||
|
|
||||||
// 2 cases to consider:
|
// 2 cases to consider:
|
||||||
// 1. server == 24 & has Talk: object_type is chat/call/room & object_id contains conversationToken/messageId
|
// 1. server == 24 & has Talk: object_type is chat/call/room & object_id contains conversationToken/messageId
|
||||||
// 2. server < 24 & has Talk: object_type is chat/call/room & object_id contains _only_ conversationToken
|
// 2. server < 24 & has Talk: object_type is chat/call/room & object_id contains _only_ conversationToken
|
||||||
|
|
|
@ -193,6 +193,10 @@ void User::slotBuildNotificationDisplay(const ActivityList &list)
|
||||||
qCInfo(lcActivity) << "Activity already notified, skip";
|
qCInfo(lcActivity) << "Activity already notified, skip";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!activity._shouldNotify) {
|
||||||
|
qCDebug(lcActivity) << "Activity should not be notified";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -226,6 +230,11 @@ void User::slotBuildIncomingCallDialogs(const ActivityList &list)
|
||||||
|
|
||||||
if(systray) {
|
if(systray) {
|
||||||
for(const auto &activity : list) {
|
for(const auto &activity : list) {
|
||||||
|
if (!activity._shouldNotify) {
|
||||||
|
qCDebug(lcActivity) << "Activity should not be notified";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
systray->createCallDialog(activity, _account);
|
systray->createCallDialog(activity, _account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue