From 4fa107584017a42019db61dcf8dfc677ec709c6c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 7 Feb 2020 19:24:55 -0800 Subject: [PATCH] popovers: Check for undefined message.edit_history. Signed-off-by: Anders Kaseorg --- static/js/popovers.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/static/js/popovers.js b/static/js/popovers.js index db69be51ab..7927ba58c0 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -439,10 +439,15 @@ exports.toggle_actions_popover = function (element, id) { topic && muting.is_topic_muted(message.stream_id, topic); - const should_display_edit_history_option = _.any(message.edit_history, function (entry) { - const prev_topic = util.get_edit_event_prev_topic(entry); - return entry.prev_content !== undefined || prev_topic !== undefined; - }) && page_params.realm_allow_edit_history; + const should_display_edit_history_option = + message.edit_history && + _.any( + message.edit_history, + entry => + entry.prev_content !== undefined || + util.get_edit_event_prev_topic(entry) !== undefined + ) && + page_params.realm_allow_edit_history; // Disabling this for /me messages is a temporary workaround // for the fact that we don't have a styling for how that