From 72bb3fb6c25ef7486eabfde1ee8b51f3d14d043c Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 8 Feb 2019 11:07:25 -0800 Subject: [PATCH] message_list: Extract clear_date_divider_html. This also fixes the fact that the logic had swapped which object should be undefined and which should be false. --- static/js/message_list_view.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js index f04ec3f774..512c73f0c3 100644 --- a/static/js/message_list_view.js +++ b/static/js/message_list_view.js @@ -93,6 +93,11 @@ function update_group_time_display(group, message_container, prev) { } } +function clear_group_date_divider(group) { + group.show_date_separator = false; + group.show_date = undefined; +} + function update_timestr(message_container) { if (message_container.timestr === undefined) { var time = new XDate(message_container.msg.timestamp * 1000); @@ -407,9 +412,7 @@ MessageListView.prototype = { new_message_groups = _.rest(new_message_groups); } else if (first_group !== undefined && second_group !== undefined) { if (same_day(prev_msg_container, curr_msg_container)) { - // Clear the date if it is the same as the last group - second_group.show_date = false; - second_group.show_date_separator = undefined; + clear_group_date_divider(second_group); } else { // If we just sent the first message on a new day // in a narrow, make sure we render a date separator.