Thelounge: Hide ranks without search match

Created on 3 Dec 2016  路  15Comments  路  Source: thelounge/thelounge

image

Simply remove the rank headers from view when there's no search matches.

Bug

All 15 comments

can i contribute to this issue?

@iamsk9 sure.

@xPaw Does this issue mean to hide the rank headers in the search bar on the right side of the application when no search matches? if yes it is working well and no rank headers are shown when there's no search matches.

It should hide the section if there are no matching users in that section (this could be used as an optimization trick too, hide the entire category instead of hiding every individual user inside).

@xPaw ok I got it.

@xPaw I fixed the issue, but I don't see how it's possible to optimize it as you wrote. In order to check if there are no matching users, you still have to loop through all of them. If you don't hide the users that don't match while you loop through them the first time, you'll have to iterate through all of them (or at least the ones to hide, which usually are most of them) again in order to hide them. Shall I open a pull request with my solution or do you have any suggestions about how to optimize it? What I have done, essentially, is to loop through each category of users (class: user-mode), then nested loop through each user of each category. If all the users of a category are hidden, then I hide also the div of the category.

I think xPaw meant you can set the parent (assuming that sections are wrapped in a parent element) to hidden instead of setting every name to hidden (less DOM modifications)

Ok, I understand. I am working towards a more performant solution. I should finish it in the next few days, hopefully already tomorrow. It's my first contribution ever, I will do my best to make it decent :)

Feel free to open a PR early (it can be marked as 'do not merge'/'wip') for feedback/so we can stay up-to-date

I just opened a PR. It's my first PR ever in my life, so any feedback that can help me to learn and improve is very welcome.

Looks like this was done in #856 (https://github.com/thelounge/lounge/pull/856#issue-198107586)

unless the result gif in #856 is outdated it wasn't fixed

Oh - I thought I saw the headings get hidden in the gif, my bad

Just checked - this is still broken on 2.2.2, but fixed on master.

Screenshots:

2.2.2:

screen shot 2017-05-29 at 7 11 24 am

master (https://github.com/thelounge/lounge/tree/1f1b025):

screen shot 2017-05-29 at 7 11 32 am

Looks like it is this commit that did the trick.

This should be addressed by v2.3.0.

Was this page helpful?
0 / 5 - 0 ratings