From e446e3d6792ff6a1664934b24e19fc80ffbbd22e Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Wed, 20 Apr 2022 21:30:16 -0400 Subject: Add loud notifications for spaces --- src/timeline/CommunitiesModel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/timeline/CommunitiesModel.cpp') 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; } } -- cgit 1.5.1