From 36bf862ab9d784ab00299cdae54ca21772307235 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 17 Aug 2023 16:41:13 -0400 Subject: [PATCH] Change the completion proxy model to filter out invalid entries When auto-completing rooms, there may be some that do not have canonical addresses (e.g. 1-to-1 chats). These can't be linked anyway, so skip them and any other unlinkable entries. --- src/models/completionproxymodel.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/models/completionproxymodel.cpp b/src/models/completionproxymodel.cpp index eb5e03813..49fc46a14 100644 --- a/src/models/completionproxymodel.cpp +++ b/src/models/completionproxymodel.cpp @@ -11,6 +11,11 @@ bool CompletionProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &so if (m_filterText.isEmpty()) { return false; } + + if (sourceModel()->data(sourceModel()->index(sourceRow, 0), filterRole()).toString().isEmpty()) { + return false; + } + return (sourceModel()->data(sourceModel()->index(sourceRow, 0), filterRole()).toString().startsWith(m_filterText, Qt::CaseInsensitive) && !m_fullText.startsWith(sourceModel()->data(sourceModel()->index(sourceRow, 0), filterRole()).toString())) || (m_secondaryFilterRole != -1