From 544bbab480802b00464088db0c6097eea7222151 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 25 Sep 2017 07:51:16 -0700 Subject: [PATCH] refactor: Require explicit call to build topic list. This will make testing a bit easier (we can stub stuff before building the widget), and it will eventually give us more control on redrawing the topic list. --- static/js/topic_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/topic_list.js b/static/js/topic_list.js index f56bbbcfd7..76c07cdbc6 100644 --- a/static/js/topic_list.js +++ b/static/js/topic_list.js @@ -56,7 +56,7 @@ exports.set_count = function (stream_id, topic, count) { } }; -exports.build_widget = function (parent_elem, my_stream_id, active_topic) { +exports.widget = function (parent_elem, my_stream_id) { var self = {}; self.build_list = function () { @@ -164,7 +164,6 @@ exports.build_widget = function (parent_elem, my_stream_id, active_topic) { } }; - self.build(active_topic); return self; }; @@ -179,7 +178,8 @@ exports.active_stream_id = function () { exports.rebuild = function (stream_li, stream_id) { var active_topic = narrow_state.topic(); exports.remove_expanded_topics(); - active_widget = exports.build_widget(stream_li, stream_id, active_topic); + active_widget = exports.widget(stream_li, stream_id); + active_widget.build(active_topic); return active_widget; // used for testing };