message_list_view: Fix missing bookend when prepending messages.

The logic for inserting bookend when prepending messages was
missing.

Fixed by inserting the bookend at the correct position.

Reproducer:

Modify `message_fetch` parameters to only fetch
one message per fetch to ensure that each message is prepended.

Subscribe to a channel and send a message.

Reload.

Bookend is absent before the latest message without this commit.
This commit is contained in:
Aman Agrawal
2025-10-14 20:52:39 +05:30
committed by Tim Abbott
parent aac651fa39
commit 9ffe31e352

View File

@@ -983,6 +983,11 @@ export class MessageListView {
update_group_date(second_group, curr_msg_container.msg, prev_msg_container?.msg);
// We could add an action to update the date row, but for now rerender the group.
message_actions.rerender_groups.push(second_group);
} else if (second_group.bookend_top) {
// We know there was no bookend_top before since we
// are adding messages to the top.
const rendered_bookend_html = render_bookend(second_group);
this.$list.prepend($(rendered_bookend_html));
}
message_actions.prepend_groups = new_message_groups;
this._message_groups = [...new_message_groups, ...this._message_groups];