mirror of https://github.com/zulip/zulip.git
Make sure a message is in the list before trying to select it.
Fixes the JS traceback "Selected message id not in MessageList" introduced by b67e52d Testing: * Narrow to a subject and send a PM * Narrow to a PM recipient and send a stream message * Narrow to a subject and send a stream message to a different subject (imported from commit 1171c3f97813dc7db891042906762be8afb2a1b5)
This commit is contained in:
parent
20c1e1bb8c
commit
49e3ba7cb3
|
@ -855,8 +855,9 @@ function get_updates_success(data) {
|
|||
// Iterate backwards to find the last message sent_by_me, stopping at
|
||||
// the pointer position.
|
||||
for (i = messages.length-1; i>=0; i--){
|
||||
if (messages[i].id <= selected_id) break;
|
||||
if (messages[i].sent_by_me) {
|
||||
var id = messages[i].id;
|
||||
if (id <= selected_id) break;
|
||||
if (messages[i].sent_by_me && current_msg_list.get(id) !== undefined) {
|
||||
// If this is a reply we just sent, advance the pointer to it.
|
||||
current_msg_list.select_id(messages[i].id, {then_scroll: true,
|
||||
from_scroll: true});
|
||||
|
|
Loading…
Reference in New Issue