1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 03:53:23 +02:00

smartlist: filter banned items when the filter string is empty

Gitlab: #418
Change-Id: I1c1a8004b8d268cb3be158a7766c5ae82d451e63
This commit is contained in:
Andreas Traczyk 2021-05-19 13:21:38 -04:00
parent a3d287148d
commit 5bb5ce0f09

View file

@ -107,12 +107,15 @@ ConversationListProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s
auto registeredName = index.data(ConversationList::Role::RegisteredName).toString();
auto itemProfileType = index.data(ConversationList::Role::ContactType).toInt();
auto typeFilter = static_cast<profile::Type>(itemProfileType) == currentTypeFilter_;
bool match {false};
if (index.data(ConversationList::Role::IsBanned).toBool()) {
return typeFilter
&& (rx.exactMatch(uri) || rx.exactMatch(alias) || rx.exactMatch(registeredName));
match = !rx.isEmpty()
&& (rx.exactMatch(uri) || rx.exactMatch(alias) || rx.exactMatch(registeredName));
} else {
match = (rx.indexIn(uri) != -1 || rx.indexIn(alias) != -1
|| rx.indexIn(registeredName) != -1);
}
return typeFilter
&& (rx.indexIn(uri) != -1 || rx.indexIn(alias) != -1 || rx.indexIn(registeredName) != -1);
return typeFilter && match;
}
bool