lightbox: Add debugging code for unknown message IDs.

This should help debug a traceback we've been seeing in production
where the fetched message was undefined.
This commit is contained in:
Tim Abbott 2018-03-23 15:16:39 -07:00
parent 78a4924ecc
commit 195b96c989
1 changed files with 5 additions and 2 deletions

View File

@ -116,9 +116,12 @@ exports.open = function (image, options) {
$type = "image"; $type = "image";
$source = $image.attr("src"); $source = $image.attr("src");
} }
var message = message_store.get($message.attr("zid"));
if (message === undefined) {
blueslip.error("Lightbox for unknown message " + $message.attr("zid"));
}
payload = { payload = {
user: message_store.get($message.attr("zid")).sender_full_name, user: message.sender_full_name,
title: $image.parent().attr("title"), title: $image.parent().attr("title"),
type: $type, type: $type,
preview: $image.attr("src"), preview: $image.attr("src"),