submessage: Move submessages === undefined check up.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-07 20:34:29 -08:00 committed by Tim Abbott
parent 4fa1075840
commit b5bf677717
1 changed files with 4 additions and 4 deletions

View File

@ -88,6 +88,10 @@ exports.update_message = function (submsg) {
return;
}
if (message.submessages === undefined) {
message.submessages = [];
}
const existing = _.find(message.submessages, function (sm) {
return sm.id === submsg.id;
});
@ -97,10 +101,6 @@ exports.update_message = function (submsg) {
return;
}
if (message.submessages === undefined) {
message.submessages = [];
}
message.submessages.push(submsg);
};