Added safety check for formatted values

This commit is contained in:
Luke Bennett 2016-10-13 13:00:06 +01:00 committed by Z.J. van de Weg
parent 35e2315a66
commit 6e509ae3b6
1 changed files with 2 additions and 2 deletions

View File

@ -204,8 +204,8 @@
const environment = environments[i];
if ($(`.mr-state-widget #${ environment.id }`).length) return;
const $template = $(DEPLOYMENT_TEMPLATE);
if (!environment.external_url) $('.js-environment-link', $template).remove();
if (environment.deployed_at) {
if (!environment.external_url || !environment.external_url_formatted) $('.js-environment-link', $template).remove();
if (environment.deployed_at && environment.deployed_at_formatted) {
environment.deployed_at = $.timeago(environment.deployed_at) + '.';
} else {
$('.js-environment-timeago', $template).remove();