Make rooms in the room list bold when there's unread messages

This used to be a feature but kinda broke/changed when we switched to
focusing on context-aware or notable events. Basically instead of only
notable events making a room bold in the room list, it's any unread
messages now.
This commit is contained in:
Joshua Goins
2025-09-09 11:43:25 +02:00
parent f53d47fa28
commit 5b4d3df6ee
5 changed files with 20 additions and 8 deletions

View File

@@ -171,7 +171,7 @@ void RoomTreeModel::connectRoomSignals(NeoChatRoom *room)
refreshRoomRoles(room, {DisplayNameRole});
});
connect(room, &Room::unreadStatsChanged, this, [this, room] {
refreshRoomRoles(room, {ContextNotificationCountRole, HasHighlightNotificationsRole});
refreshRoomRoles(room, {ContextNotificationCountRole, HasHighlightNotificationsRole, NotificationCountRole});
if (room->isServerNoticeRoom()) {
Q_EMIT invalidateSort();
}
@@ -294,6 +294,7 @@ QHash<int, QByteArray> RoomTreeModel::roleNames() const
roles[DelegateTypeRole] = "delegateType";
roles[IconRole] = "icon";
roles[RoomTypeRole] = "roomType";
roles[NotificationCountRole] = "notificationCount";
return roles;
}
@@ -396,6 +397,9 @@ QVariant RoomTreeModel::data(const QModelIndex &index, int role) const
return room->creation()->contentPart<QString>("type"_L1);
}
}
if (role == NotificationCountRole) {
return room->notificationCount();
}
return {};
}