message_list_view: Change date of sticky header more carefully.

If the sticky recipient bar hides the date separator completely,
the recipient bar needs to show the correct date for the message
next to it, otherwise the user will see the wrong date for the
message.

To fix this, we show the date on the date separator as soon as
the sticky message header starts to overlap with the date separator.
This commit is contained in:
Aman Agrawal
2023-04-17 23:20:15 +00:00
committed by Tim Abbott
parent 96b051bec4
commit 5b71acf21b

View File

@@ -1511,10 +1511,14 @@ export class MessageListView {
} else {
$sticky_header.addClass("sticky_header");
const sticky_header_props = $sticky_header[0].getBoundingClientRect();
/* date separator starts to be hidden at this height difference. */
const date_separator_padding = 7;
const sticky_header_bottom = sticky_header_props.top + sticky_header_props.height;
const possible_new_date_separator_start = sticky_header_bottom - date_separator_padding;
/* Get `message_row` under the sticky header. */
const elements_below_sticky_header = document.elementsFromPoint(
sticky_header_props.left,
sticky_header_props.top,
possible_new_date_separator_start,
);
$message_row = $(
elements_below_sticky_header.filter((element) =>