Notification Consistency
Make sure that the new rules for counting notifications for muted, mention and low priority rooms is applied consistently to the room list, space drawer and the task manager notification badge implements #644
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <QTemporaryFile>
|
||||
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/quotient_common.h>
|
||||
#include <Quotient/user.h>
|
||||
#include <qcoro/qcorosignal.h>
|
||||
|
||||
@@ -129,15 +130,32 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
|
||||
connect(&SpaceHierarchyCache::instance(), &SpaceHierarchyCache::spaceHierarchyChanged, this, [this]() {
|
||||
if (isSpace()) {
|
||||
Q_EMIT childrenNotificationCountChanged();
|
||||
Q_EMIT childrenHaveHighlightNotificationsChanged();
|
||||
}
|
||||
});
|
||||
connect(&SpaceHierarchyCache::instance(), &SpaceHierarchyCache::spaceNotifcationCountChanged, this, [this](const QStringList &spaces) {
|
||||
if (spaces.contains(id())) {
|
||||
Q_EMIT childrenNotificationCountChanged();
|
||||
Q_EMIT childrenHaveHighlightNotificationsChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int NeoChatRoom::contextAwareNotificationCount() const
|
||||
{
|
||||
// DOn't include spaces, rooms that the user hasn't joined and rooms where the user has joined the successor.
|
||||
if (isSpace() || joinState() != JoinState::Join || successor(JoinState::Join) != nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if (m_currentPushNotificationState == PushNotificationState::Mute) {
|
||||
return 0;
|
||||
}
|
||||
if (m_currentPushNotificationState == PushNotificationState::MentionKeyword || isLowPriority()) {
|
||||
return int(highlightCount());
|
||||
}
|
||||
return int(notificationCount());
|
||||
}
|
||||
|
||||
bool NeoChatRoom::hasFileUploading() const
|
||||
{
|
||||
return m_hasFileUploading;
|
||||
@@ -1300,6 +1318,14 @@ qsizetype NeoChatRoom::childrenNotificationCount()
|
||||
return SpaceHierarchyCache::instance().notificationCountForSpace(id());
|
||||
}
|
||||
|
||||
bool NeoChatRoom::childrenHaveHighlightNotifications() const
|
||||
{
|
||||
if (!isSpace()) {
|
||||
return false;
|
||||
}
|
||||
return SpaceHierarchyCache::instance().spaceHasHighlightNotifications(id());
|
||||
}
|
||||
|
||||
void NeoChatRoom::addChild(const QString &childId, bool setChildParent, bool canonical, bool suggested)
|
||||
{
|
||||
if (!isSpace()) {
|
||||
|
||||
Reference in New Issue
Block a user