Fix account bar scrolling when room list filtered

This commit is contained in:
miruka 2020-05-01 13:02:20 -04:00
parent cc4a780865
commit 5373d19c83

View File

@ -43,13 +43,15 @@ HListView {
property alias filter: filterModel.filter property alias filter: filterModel.filter
readonly property var sectionIndice: { readonly property var sectionIndice: {
const sections = {} const sections = {}
const accounts = ModelStore.get("accounts") let currentUserId = null
let total = 0
for (let i = 0; i < accounts.count; i++) { for (let i = 0; i < model.filtered.count; i++) {
const userId = accounts.get(i).id const userId = model.filtered.get(i).model.for_account
sections[userId] = total
total += ModelStore.get(userId, "rooms").count if (userId !== currentUserId) {
sections[userId] = i
currentUserId = userId
}
} }
return sections return sections