From b5bf677717f763d185bdcc0d6306569c83c50374 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 7 Feb 2020 20:34:29 -0800 Subject: [PATCH] submessage: Move submessages === undefined check up. Signed-off-by: Anders Kaseorg --- static/js/submessage.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/submessage.js b/static/js/submessage.js index 930ca3d080..5acec2359e 100644 --- a/static/js/submessage.js +++ b/static/js/submessage.js @@ -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); };