Show date correctly on message headers.

This shows a date on a message header whenever the date of that
message is different than the date of the previous message.

The previous logic was bugged and didn't display dates in headers at
date transition points.
This commit is contained in:
Brock Whittaker 2017-01-05 16:44:34 -08:00 committed by Tim Abbott
parent af1998fbb8
commit 3d5c24ab40
3 changed files with 5 additions and 8 deletions

View File

@ -89,10 +89,6 @@ function populate_group_from_message_container(group, message_container) {
var time = new XDate(message_container.msg.timestamp * 1000);
var date_element = timerender.render_date(time)[0];
if (!message_container.show_date) {
date_element.className = "hide-date";
}
group.date = date_element.outerHTML;
}
@ -333,6 +329,7 @@ MessageListView.prototype = {
} else if (first_group !== undefined && second_group !== undefined) {
var last_msg_container = _.last(first_group.message_containers);
var first_msg_container = _.first(second_group.message_containers);
if (same_day(last_msg_container, first_msg_container)) {
// Clear the date if it is the same as the last group
second_group.show_date = undefined;

View File

@ -664,11 +664,11 @@ td.pointer {
line-height: 17px;
}
.recipient_row_date .hide-date {
.recipient_row_date.hide-date {
display: none;
}
.floating_recipient .recipient_row_date .hide-date {
.floating_recipient .recipient_row_date.hide-date {
display: block;
}

View File

@ -51,7 +51,7 @@
<span class="topic_edit_form" id="{{id}}"></span>
</span>
<span class="recipient_row_date">{{{date}}}</span>
<span class="recipient_row_date {{#if show_date}}{{else}}hide-date{{/if}}">{{{date}}}</span>
</div>
</div>
</div>
@ -65,7 +65,7 @@
{{#tr this}}You and __display_reply_to__{{/tr}}
</a>
<span class="recipient_row_date">{{{date}}}</span>
<span class="recipient_row_date {{#if show_date}}{{else}}hide-date{{/if}}">{{{date}}}</span>
</div>
</div>
</div>