From ca9ef58318e9c00b97e3dd4bed52f96193827864 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 28 Aug 2019 12:37:42 +0100 Subject: [PATCH] FIX: Allow dashboard to load even when git version cannot be found --- .../admin/templates/dashboard_general.hbs | 16 +++++++++------- app/models/admin_dashboard_general_data.rb | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/admin/templates/dashboard_general.hbs b/app/assets/javascripts/admin/templates/dashboard_general.hbs index 2feaefe97de..af0bb36ae99 100644 --- a/app/assets/javascripts/admin/templates/dashboard_general.hbs +++ b/app/assets/javascripts/admin/templates/dashboard_general.hbs @@ -117,13 +117,15 @@

{{i18n "admin.dashboard.last_updated"}}

{{format-date model.attributes.updated_at leaveAgo="true"}}

-
-

{{i18n "admin.dashboard.discourse_last_updated"}}

-

{{format-date model.attributes.discourse_updated_at leaveAgo="true"}}

- - {{i18n "admin.dashboard.whats_new_in_discourse"}} - -
+ {{#if model.attributes.discourse_updated_at}} +
+

{{i18n "admin.dashboard.discourse_last_updated"}}

+

{{format-date model.attributes.discourse_updated_at leaveAgo="true"}}

+ + {{i18n "admin.dashboard.whats_new_in_discourse"}} + +
+ {{/if}} diff --git a/app/models/admin_dashboard_general_data.rb b/app/models/admin_dashboard_general_data.rb index 84bff945f26..0d2a986e78e 100644 --- a/app/models/admin_dashboard_general_data.rb +++ b/app/models/admin_dashboard_general_data.rb @@ -2,7 +2,7 @@ class AdminDashboardGeneralData < AdminDashboardData def get_json - days_since_update = ((DateTime.now - Discourse.last_commit_date) / 1.day).to_i + days_since_update = Discourse.last_commit_date ? ((DateTime.now - Discourse.last_commit_date) / 1.day).to_i : nil { updated_at: Time.zone.now.as_json, discourse_updated_at: Discourse.last_commit_date,