mirror of https://github.com/zulip/zulip.git
Fix "Selected message id not in MessageList" caused by summarization.
Summarized messages are not shown and cannot be selected. If `opts.use_closest === false` and you try to select a summarized message, we still have to use the closest instead of failing. Eventually, we'll make summary rows selectable, but that would be rather involved since selections are managed by ID, summaries exist only in the DOM, and many parts of the code get the selection and expect it to be a message. (imported from commit 998c4f24aece84528cc9da53a47f9e4f5391702d)
This commit is contained in:
parent
3cd012931b
commit
eb2e8a15c3
|
@ -127,7 +127,8 @@ MessageList.prototype = {
|
|||
if (isNaN(id)) {
|
||||
blueslip.fatal("Bad message id");
|
||||
}
|
||||
if (this.get(id) === undefined || this._is_summarized_message(this.get(id))) {
|
||||
|
||||
if (this.get(id) === undefined) {
|
||||
if (!opts.use_closest) {
|
||||
blueslip.error("Selected message id not in MessageList",
|
||||
{table_name: this.table_name, id: id});
|
||||
|
@ -136,6 +137,10 @@ MessageList.prototype = {
|
|||
opts.id = id;
|
||||
}
|
||||
|
||||
if (this._is_summarized_message(this.get(id))) {
|
||||
id = opts.id = this.closest_id(id);
|
||||
}
|
||||
|
||||
this._selected_id = id;
|
||||
if (!opts.from_rendering) {
|
||||
this._maybe_rerender();
|
||||
|
|
Loading…
Reference in New Issue