mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
message_list_view: Fix exception prepending when visibly empty.
In an upcoming commit, we will fix a bug that caused the message_list_data system to append rather than prepending when previously all the messages in a message list were hidden due to topic/user muting.
This commit is contained in:
@@ -1336,6 +1336,21 @@ export class MessageListView {
|
||||
}
|
||||
|
||||
prepend(messages) {
|
||||
if (this._render_win_end - this._render_win_start === 0) {
|
||||
// If the message list previously contained no visible
|
||||
// messages, appending and prepending are equivalent, but
|
||||
// the prepend logic will throw an exception, so just
|
||||
// handle this as an append request.
|
||||
//
|
||||
// This is somewhat hacky, but matches how we do rendering
|
||||
// for the first messages in a new msg_list_data object.
|
||||
this.append(messages, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we already have some messages rendered, then prepending
|
||||
// will effectively change the meaning of the existing
|
||||
// numbers.
|
||||
this._render_win_start += messages.length;
|
||||
this._render_win_end += messages.length;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user