From e68de7ac8d011af0bec6ca2765027f198173f68a Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 27 Aug 2017 16:40:34 -0700 Subject: [PATCH] user popover: Don't throw an exception for deactivated target users. Ideally, we'd fix this at the root cause, via #4322, but this will at least suppress the exception for now. --- static/js/popovers.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/static/js/popovers.js b/static/js/popovers.js index e1fd8a7e2f..9433445481 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -55,7 +55,16 @@ function user_last_seen_time_status(user_id) { // We don't send presence data to clients in Zephyr mirroring realms return i18n.t("Unknown"); } - return timerender.last_seen_status_from_date(presence.last_active_date(user_id).clone()); + + // TODO: If the user account has been deactivated, it won't appear + // in the presence data set. Ideally, we'd have a cleaner + // solution that had us understand that state declaratively and + // thus not need this check (see #4322). + var last_active_date = presence.last_active_date(user_id); + if (last_active_date === undefined) { + return i18n.t("Unknown"); + } + return timerender.last_seen_status_from_date(last_active_date.clone()); } function show_message_info_popover(element, id) {