fix(InviteFriendsToCommunityPopup): proper spacing when searching

Closes: #7707
This commit is contained in:
Michał Cieślak 2022-12-02 00:04:28 +01:00 committed by Michał
parent 55668f160c
commit 4d5ef972bf
1 changed files with 36 additions and 23 deletions

View File

@ -13,6 +13,8 @@ import shared.stores 1.0
// TODO move Contact into shared to get rid of that import // TODO move Contact into shared to get rid of that import
import AppLayouts.Chat.controls 1.0 import AppLayouts.Chat.controls 1.0
import SortFilterProxyModel 0.2
Item { Item {
id: root id: root
@ -46,9 +48,42 @@ Item {
leftMargin: 0 leftMargin: 0
spacing: Style.current.padding spacing: Style.current.padding
model: root.contactsStore.myContactsModel model: SortFilterProxyModel {
sourceModel: root.contactsStore.myContactsModel
filters: [
ExpressionFilter {
expression: {
root.filterText
root.hideCommunityMembers
root.communityId
if (root.pubKeys.indexOf(model.pubKey) > -1)
return true
if (!model.isContact || model.isBlocked)
return false
const filter = root.filterText.toLowerCase()
const filterAccepted = root.filterText === ""
|| root.matchesAlias(model.alias.toLowerCase(), filter)
|| model.displayName.toLowerCase().includes(filter)
|| model.ensName.toLowerCase().includes(filter)
|| model.localNickname.toLowerCase().includes(filter)
|| model.pubKey.toLowerCase().includes(filter)
if (!filterAccepted)
return false
return !root.hideCommunityMembers ||
!root.rootStore.communityHasMember(root.communityId, model.pubKey)
}
}
]
}
delegate: StatusMemberListItem { delegate: StatusMemberListItem {
width: contactListView.availableWidth width: contactListView.availableWidth
pubKey: Utils.getCompressedPk(model.pubKey) pubKey: Utils.getCompressedPk(model.pubKey)
isContact: model.isContact isContact: model.isContact
status: model.onlineStatus status: model.onlineStatus
@ -66,28 +101,6 @@ Item {
statusListItemIcon.badge.implicitHeight: 14 // 10 px + 2 px * 2 borders statusListItemIcon.badge.implicitHeight: 14 // 10 px + 2 px * 2 borders
statusListItemIcon.badge.implicitWidth: 14 // 10 px + 2 px * 2 borders statusListItemIcon.badge.implicitWidth: 14 // 10 px + 2 px * 2 borders
visible: {
if (contactCheckbox.checked)
return true
if (!model.isContact || model.isBlocked)
return false
const filter = root.filterText.toLowerCase()
const filterAccepted = root.filterText === ""
|| root.matchesAlias(model.alias.toLowerCase(), filter)
|| model.displayName.toLowerCase().includes(filter)
|| model.ensName.toLowerCase().includes(filter)
|| model.localNickname.toLowerCase().includes(filter)
|| model.pubKey.toLowerCase().includes(filter)
if (!filterAccepted)
return false
return !root.hideCommunityMembers ||
!root.rootStore.communityHasMember(root.communityId, model.pubKey)
}
onClicked: { onClicked: {
root.contactClicked(model); root.contactClicked(model);
} }