mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
message_list: Rename confusing hide-date CSS class.
The previous hide-date CSS class had a semantic meaning of "this recipient row has the same date as the previous one"; since we're now having logic read that value, it's worth giving it a semantic name that makes that code easier to understand.
This commit is contained in:
@@ -116,12 +116,12 @@ function update_group_date(group, message_container, prev) {
|
|||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
|
||||||
// Show the date in the recipient bar if the previous message was from a different day.
|
// Show the date in the recipient bar if the previous message was from a different day.
|
||||||
group.show_recipient_bar_date = !same_day(message_container, prev);
|
group.date_unchanged = same_day(message_container, prev);
|
||||||
group.group_date_html = timerender.render_date(time, today)[0].outerHTML;
|
group.group_date_html = timerender.render_date(time, today)[0].outerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clear_group_date(group) {
|
function clear_group_date(group) {
|
||||||
group.show_recipient_bar_date = true;
|
group.date_unchanged = false;
|
||||||
group.group_date_html = undefined;
|
group.group_date_html = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1542,12 +1542,9 @@ export class MessageListView {
|
|||||||
// hiding the date display on the non-sticky previous
|
// hiding the date display on the non-sticky previous
|
||||||
// recipient row.
|
// recipient row.
|
||||||
$(".hide-date-separator-header").removeClass("hide-date-separator-header");
|
$(".hide-date-separator-header").removeClass("hide-date-separator-header");
|
||||||
// The hide-date CSS class is set on recipient_row_date
|
// This corner case only occurs when the date is unchanged
|
||||||
// elements where the previous row had the same date; these
|
// from the previous recipient row.
|
||||||
// will only display the date when sticky. Since this corner
|
if ($sticky_header.find(".recipient_row_date.recipient_row_date_unchanged").length) {
|
||||||
// case only is relevant with an identical date, we start by
|
|
||||||
// checking whether the hide-date class is present.
|
|
||||||
if ($sticky_header.find(".recipient_row_date.hide-date").length) {
|
|
||||||
const $prev_recipient_row = $sticky_header
|
const $prev_recipient_row = $sticky_header
|
||||||
.closest(".recipient_row")
|
.closest(".recipient_row")
|
||||||
.prev(".recipient_row");
|
.prev(".recipient_row");
|
||||||
@@ -1556,7 +1553,7 @@ export class MessageListView {
|
|||||||
}
|
}
|
||||||
const $prev_header_date_row = $prev_recipient_row.find(".recipient_row_date");
|
const $prev_header_date_row = $prev_recipient_row.find(".recipient_row_date");
|
||||||
// Check if the recipient row before sticky header is a date separator.
|
// Check if the recipient row before sticky header is a date separator.
|
||||||
if (!$prev_header_date_row.hasClass("hide-date")) {
|
if (!$prev_header_date_row.hasClass("recipient_row_date_unchanged")) {
|
||||||
$prev_header_date_row.addClass("hide-date-separator-header");
|
$prev_header_date_row.addClass("hide-date-separator-header");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1100,12 +1100,6 @@ td.pointer {
|
|||||||
top: var(--sidebar-top);
|
top: var(--sidebar-top);
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
box-shadow: 0 -1px 0 0 hsl(0, 0%, 100%);
|
box-shadow: 0 -1px 0 0 hsl(0, 0%, 100%);
|
||||||
|
|
||||||
&.sticky_header {
|
|
||||||
.recipient_row_date {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1181,7 +1175,15 @@ td.pointer {
|
|||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
|
||||||
&.hide-date,
|
/* Display the date when unchanged only for sticky headers. */
|
||||||
|
&.recipient_row_date_unchanged {
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
.sticky_header & {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.hide-date-separator-header {
|
&.hide-date-separator-header {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
</template>
|
</template>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
<span class="recipient_row_date {{#if show_recipient_bar_date}}{{else}}hide-date{{/if}}">{{{date}}}</span>
|
<span class="recipient_row_date {{#if date_unchanged}}recipient_row_date_unchanged{{/if}}">{{{date}}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
{{t "You and {display_reply_to}" }}
|
{{t "You and {display_reply_to}" }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<span class="recipient_row_date {{#if show_recipient_bar_date}}{{else}}hide-date{{/if}}">{{{date}}}</span>
|
<span class="recipient_row_date {{#if date_unchanged}}recipient_row_date_unchanged{{/if}}">{{{date}}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user