From 1eab59d1b5f23992d944a61356c67a29edb61d45 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 17 Jan 2020 21:30:40 +0000 Subject: [PATCH] topic list: Kill off "no more topics". If you clicked for no more topics and then the server didn't find any, we once had code that would say "No more topics" in light gray at the bottom of the topic list. The feature appears to have been broken by some detail in the `self.dom` refactoring. More importantly, it's not clear it's useful as opposed to clutter. Since we added the `stream.first_message_id` feature, it's now very rare for the `more topics` option to appear when there aren't in fact older topics that could be fetched. In cases where there are not, the UI is still clear about what's happening -- it shows a loading indicator and then displays a list of topics that doesn't have anything new. So we're removing this feature; we can re-add it without too much difficulty if user feedback in the future suggests it would be useful after all. --- static/js/topic_list.js | 47 ++------------------------------ static/styles/left-sidebar.scss | 11 -------- static/templates/more_topics.hbs | 3 -- 3 files changed, 2 insertions(+), 59 deletions(-) diff --git a/static/js/topic_list.js b/static/js/topic_list.js index aa02a1b239..f21b16cc1e 100644 --- a/static/js/topic_list.js +++ b/static/js/topic_list.js @@ -283,15 +283,7 @@ exports.widget = function (parent_elem, my_stream_id) { spinner.show(); }; - self.show_no_more_topics = function () { - const elem = self.dom.find('.no-more-topics-found'); - elem.show(); - self.no_more_topics = true; - }; - - self.build = function (active_topic, no_more_topics) { - self.no_more_topics = false; // for now - + self.build = function (active_topic) { if (active_topic) { active_topic = active_topic.toLowerCase(); } @@ -300,14 +292,6 @@ exports.widget = function (parent_elem, my_stream_id) { self.dom = self.build_list(); parent_elem.append(self.dom); - - // We often rebuild an entire topic list, and the - // caller will pass us in no_more_topics as true - // if we were showing "No more topics found" from - // the initial zooming. - if (no_more_topics) { - self.show_no_more_topics(); - } }; return self; @@ -334,31 +318,12 @@ exports.get_stream_li = function () { return stream_li; }; -exports.need_to_show_no_more_topics = function (stream_id) { - // This function is important, and the use case here is kind of - // subtle. We do complete redraws of the topic list when new - // messages come in, and we don't want to overwrite the - // "no more topics" error message. - if (!zoomed) { - return false; - } - - if (!active_widgets.has(stream_id)) { - return false; - } - - const widget = active_widgets.get(stream_id); - - return widget.no_more_topics; -}; - exports.rebuild = function (stream_li, stream_id) { const active_topic = narrow_state.topic(); - const no_more_topics = exports.need_to_show_no_more_topics(stream_id); exports.remove_expanded_topics(); const widget = exports.widget(stream_li, stream_id); - widget.build(active_topic, no_more_topics); + widget.build(active_topic); active_widgets.set(stream_id, widget); }; @@ -376,8 +341,6 @@ exports.zoom_in = function () { const active_widget = active_widgets.get(stream_id); - const before_count = active_widget.num_items(); - function on_success() { if (!active_widgets.has(stream_id)) { blueslip.warn('User re-narrowed before topic history was returned.'); @@ -396,12 +359,6 @@ exports.zoom_in = function () { const widget = active_widgets.get(stream_id); exports.rebuild(widget.get_parent(), stream_id); - - const after_count = widget.num_items(); - - if (after_count === before_count) { - widget.show_no_more_topics(); - } } ui.get_scroll_element($('#stream-filters-container')).scrollTop(0); diff --git a/static/styles/left-sidebar.scss b/static/styles/left-sidebar.scss index 61dd33d796..9d2d9242ab 100644 --- a/static/styles/left-sidebar.scss +++ b/static/styles/left-sidebar.scss @@ -527,17 +527,6 @@ li.expanded_private_message a { margin-left: 6px; } -.no-more-topics-found { - opacity: 0.7; - font-style: italic; - margin: 2px 0px 0px 6px; - font-size: 0.9em; -} - -.no-more-topics-found { - display: none; -} - .zoom-in .show-more-topics { display: none; } diff --git a/static/templates/more_topics.hbs b/static/templates/more_topics.hbs index 8ee8a0feb9..4d809e2d1f 100644 --- a/static/templates/more_topics.hbs +++ b/static/templates/more_topics.hbs @@ -9,6 +9,3 @@
  • -
  • - {{t "No more topics." }} -