From 74deb684e13ae2da3ce9a790ca2a0e7767d37324 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Wed, 20 Aug 2025 20:53:14 +0200 Subject: [PATCH] Don't show AddDirect delegate if we don't have any DMs In this case, it's nicer to fall back to the placeholder, which has the same action --- src/rooms/models/sortfilterroomtreemodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rooms/models/sortfilterroomtreemodel.cpp b/src/rooms/models/sortfilterroomtreemodel.cpp index 1ea1d93c2..79422bc9d 100644 --- a/src/rooms/models/sortfilterroomtreemodel.cpp +++ b/src/rooms/models/sortfilterroomtreemodel.cpp @@ -82,8 +82,8 @@ QString SortFilterRoomTreeModel::filterText() const bool SortFilterRoomTreeModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { if (!source_parent.isValid()) { - if (sourceModel()->data(sourceModel()->index(source_row, 0), RoomTreeModel::CategoryRole).toInt() == NeoChatRoomType::AddDirect - && m_mode == DirectChats) { + if (sourceModel()->data(sourceModel()->index(source_row, 0), RoomTreeModel::CategoryRole).toInt() == NeoChatRoomType::AddDirect && m_mode == DirectChats + && sourceModel()->rowCount(sourceModel()->index(NeoChatRoomType::Direct, 0)) > 0) { return true; } return false;