diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 index 044ad687451..6997cb9f0c1 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 @@ -111,13 +111,6 @@ export default Ember.Controller.extend(PeriodComputationMixin, { return { startDate, endDate }; }, - @computed("model.attributes.updated_at") - updatedTimestamp(updatedAt) { - return moment(updatedAt) - .tz(moment.tz.guess()) - .format("LLL"); - }, - _reportsForPeriodURL(period) { return Discourse.getURL(`/admin?period=${period}`); } diff --git a/app/assets/javascripts/admin/models/admin-dashboard.js.es6 b/app/assets/javascripts/admin/models/admin-dashboard.js.es6 index 15a111445b1..20cdbe27721 100644 --- a/app/assets/javascripts/admin/models/admin-dashboard.js.es6 +++ b/app/assets/javascripts/admin/models/admin-dashboard.js.es6 @@ -1,6 +1,10 @@ import { ajax } from "discourse/lib/ajax"; -const GENERAL_ATTRIBUTES = ["updated_at"]; +const GENERAL_ATTRIBUTES = [ + "updated_at", + "discourse_updated_at", + "release_notes_link" +]; const AdminDashboard = Discourse.Model.extend({}); diff --git a/app/assets/javascripts/admin/templates/dashboard_general.hbs b/app/assets/javascripts/admin/templates/dashboard_general.hbs index 2d8c0e4a6bf..2feaefe97de 100644 --- a/app/assets/javascripts/admin/templates/dashboard_general.hbs +++ b/app/assets/javascripts/admin/templates/dashboard_general.hbs @@ -115,8 +115,12 @@

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

-

{{updatedTimestamp}}

- +

{{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"}}
diff --git a/app/assets/stylesheets/common/admin/dashboard.scss b/app/assets/stylesheets/common/admin/dashboard.scss index bb4a91874b3..8d42b716bbf 100644 --- a/app/assets/stylesheets/common/admin/dashboard.scss +++ b/app/assets/stylesheets/common/admin/dashboard.scss @@ -249,6 +249,7 @@ .last-dashboard-update { text-align: center; display: flex; + flex-direction: column; justify-content: center; div { align-self: center; diff --git a/app/models/admin_dashboard_general_data.rb b/app/models/admin_dashboard_general_data.rb index 915ddd1a38a..84bff945f26 100644 --- a/app/models/admin_dashboard_general_data.rb +++ b/app/models/admin_dashboard_general_data.rb @@ -2,8 +2,11 @@ class AdminDashboardGeneralData < AdminDashboardData def get_json + days_since_update = ((DateTime.now - Discourse.last_commit_date) / 1.day).to_i { - updated_at: Time.zone.now.as_json + updated_at: Time.zone.now.as_json, + discourse_updated_at: Discourse.last_commit_date, + release_notes_link: "https://meta.discourse.org/c/feature/announcements?tags=release-notes&before=#{days_since_update}" } end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index b8aa27bf858..f7bc57c14bb 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -3008,7 +3008,8 @@ en: dashboard: title: "Dashboard" - last_updated: "Dashboard last updated:" + last_updated: "Dashboard updated:" + discourse_last_updated: "Discourse updated:" version: "Version" up_to_date: "You're up to date!" critical_available: "A critical update is available." diff --git a/lib/discourse.rb b/lib/discourse.rb index ac91ccadfb4..9c2feccf236 100644 --- a/lib/discourse.rb +++ b/lib/discourse.rb @@ -437,6 +437,16 @@ module Discourse end end + def self.last_commit_date + ensure_version_file_loaded + $last_commit_date ||= + begin + git_cmd = 'git log -1 --format="%ct"' + seconds = self.try_git(git_cmd, nil) + seconds.nil? ? nil : DateTime.strptime(seconds, '%s') + end + end + def self.try_git(git_cmd, default_value) version_value = false