topic_list: Fix minor bug with "more topics".

There was an edge case with the old
code when you had exactly between 6 and 8
topics and all in cache, with a couple of
the topics being unread.

We would show "more topics" when you were
actually seeing all your possible topics.

To test this:
    - create 7 topics on Venice
    - as Iago, narrow to any of the Venice
      topics
    - as Aaron, send unreads to 3 or 4
      of the other topics

Eventually Iago will have all possible
topics in the sidebar.  On master we'll
show "more topics", whereas after this commit
we correctly avoid that.

It's a pretty harmless bug, since it just
leads to a useless zoom-in.

I have always felt we should zoom-in
regardless of how many topics you have,
just for consistency sake, but I also
understand the rationale behind our
current intentions.
This commit is contained in:
Steve Howell 2020-01-18 00:37:44 +00:00 committed by Tim Abbott
parent 27bcdc567f
commit 0f368b3373
1 changed files with 5 additions and 1 deletions

View File

@ -207,7 +207,11 @@ exports.widget = function (parent_elem, my_stream_id) {
const show_more = self.build_more_topics_section(more_topics_unreads);
const sub = stream_data.get_sub_by_id(my_stream_id);
if (num_possible_topics > max_topics || !stream_data.all_topics_in_cache(sub)) {
const is_showing_all_possible_topics =
list_info.items.length === num_possible_topics &&
stream_data.all_topics_in_cache(sub);
if (!is_showing_all_possible_topics) {
ul.append(show_more);
}
return ul;