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:
James Graham
2024-03-01 17:56:13 +00:00
parent 943f6c762c
commit f557ceda19
15 changed files with 238 additions and 154 deletions

View File

@@ -126,16 +126,8 @@ qsizetype SpaceHierarchyCache::notificationCountForSpace(const QString &spaceId)
for (const auto &childId : children) {
if (const auto child = static_cast<NeoChatRoom *>(m_connection->room(childId))) {
auto category = NeoChatRoomType::typeForRoom(child);
if (!added.contains(child->id()) && child->successorId().isEmpty()) {
switch (category) {
case NeoChatRoomType::Normal:
case NeoChatRoomType::Favorite:
notifications += child->notificationCount();
break;
default:
notifications += child->highlightCount();
}
if (!added.contains(child->id())) {
notifications += child->contextAwareNotificationCount();
added += child->id();
}
}
@@ -143,6 +135,19 @@ qsizetype SpaceHierarchyCache::notificationCountForSpace(const QString &spaceId)
return notifications;
}
bool SpaceHierarchyCache::spaceHasHighlightNotifications(const QString &spaceId)
{
auto children = m_spaceHierarchy[spaceId];
for (const auto &childId : children) {
if (const auto child = static_cast<NeoChatRoom *>(m_connection->room(childId))) {
if (child->highlightCount() > 0) {
return true;
}
}
}
return false;
}
bool SpaceHierarchyCache::isChild(const QString &roomId) const
{
const auto childrens = m_spaceHierarchy.values();