summary refs log tree commit diff
path: root/src/timeline/CommunitiesModel.cpp
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2022-04-20 21:30:16 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2022-06-29 22:04:17 -0400
commite446e3d6792ff6a1664934b24e19fc80ffbbd22e (patch)
tree06efa0c032dc6148ef3163e2ea75c5def2920624 /src/timeline/CommunitiesModel.cpp
parentAdd space notifications to room list (diff)
downloadnheko-e446e3d6792ff6a1664934b24e19fc80ffbbd22e.tar.xz
Add loud notifications for spaces
Diffstat (limited to 'src/timeline/CommunitiesModel.cpp')
-rw-r--r--src/timeline/CommunitiesModel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp
index 724a6e60..ccc0adfe 100644
--- a/src/timeline/CommunitiesModel.cpp
+++ b/src/timeline/CommunitiesModel.cpp
@@ -37,6 +37,7 @@ CommunitiesModel::roleNames() const
       {Depth, "depth"},
       {Id, "id"},
       {UnreadMessages, "unreadMessages"},
+      {HasLoudNotification, "hasLoudNotification"},
     };
 }
 
@@ -80,6 +81,7 @@ CommunitiesModel::data(const QModelIndex &index, int role) const
         case CommunitiesModel::Roles::Id:
             return "";
         case CommunitiesModel::Roles::UnreadMessages:
+        case CommunitiesModel::Roles::HasLoudNotification:
             return 0;
         }
     } else if (index.row() == 1) {
@@ -103,6 +105,7 @@ CommunitiesModel::data(const QModelIndex &index, int role) const
         case CommunitiesModel::Roles::Id:
             return "dm";
         case CommunitiesModel::Roles::UnreadMessages:
+        case CommunitiesModel::Roles::HasLoudNotification:
             return 0;
         }
     } else if (index.row() - 2 < spaceOrder_.size()) {
@@ -132,7 +135,9 @@ CommunitiesModel::data(const QModelIndex &index, int role) const
         case CommunitiesModel::Roles::Id:
             return "space:" + id;
         case CommunitiesModel::Roles::UnreadMessages:
-            return utils::getChildNotificationsForSpace(id);
+            return utils::getChildNotificationsForSpace(id).first;
+        case CommunitiesModel::Roles::HasLoudNotification:
+            return utils::getChildNotificationsForSpace(id).second > 0;
         }
     } else if (index.row() - 2 < tags_.size() + spaceOrder_.size()) {
         auto tag = tags_.at(index.row() - 2 - spaceOrder_.size());
@@ -187,6 +192,7 @@ CommunitiesModel::data(const QModelIndex &index, int role) const
         case CommunitiesModel::Roles::Id:
             return "tag:" + tag;
         case CommunitiesModel::Roles::UnreadMessages:
+        case CommunitiesModel::Roles::HasLoudNotification:
             return 0;
         }
     }