fix(@desktop/chat): sort users by online status

Users model has to be sorted by online status first, otherwise
`UserListPanel` sections will be duplicated. That's because:

> Note: Adding sections to a ListView does not automatically re-order
the list items by the section criteria. If the model is not ordered by
section, then it is possible that the sections created will not be
unique; each boundary between differing sections will result in a
section header being created even if that section exists elsewhere.

fixes: #6563
This commit is contained in:
Patryk Osmaczko 2022-07-21 12:30:56 +02:00 committed by osmaczko
parent eeb77aeb51
commit f9b3f91bf1
1 changed files with 10 additions and 4 deletions

View File

@ -54,10 +54,16 @@ Item {
model: SortFilterProxyModel {
sourceModel: usersModule.model
sorters: StringSorter {
roleName: "displayName"
caseSensitivity: Qt.CaseInsensitive
}
sorters: [
RoleSorter {
roleName: "onlineStatus"
sortOrder: Qt.DescendingOrder
},
StringSorter {
roleName: "displayName"
caseSensitivity: Qt.CaseInsensitive
}
]
}
section.property: "onlineStatus"
section.delegate: (root.width > 58) ? sectionDelegateComponent : null