Fix last account always being hidden

This commit is contained in:
miruka 2019-08-19 18:49:56 -04:00
parent 5c75de68ea
commit 16ac335d43

View File

@ -35,7 +35,8 @@ HListView {
! Utils.filterMatches( ! Utils.filterMatches(
filter, show[show.length - 1].data.filter_string) filter, show[show.length - 1].data.filter_string)
) { ) {
// If current and previous items are both accounts, // If filter active, current and previous items are
// both accounts and previous account doesn't match filter,
// that means the previous account had no matching rooms. // that means the previous account had no matching rooms.
show.pop() show.pop()
} }
@ -44,8 +45,14 @@ HListView {
} }
} }
// If last item is an account, that account had no matching rooms. let last = show[show.length - 1]
if (show.length && show[show.length - 1].type == "Account") show.pop() if (show.length && filter && last.type == "Account" &&
! Utils.filterMatches(filter, last.data.filter_string))
{
// If filter active, last item is an account and last item
// doesn't match filter, that account had no matching rooms.
show.pop()
}
model.source = show model.source = show
} }