From 1b89c2f0ef99b29f92f0ed6b55be1d24817957dd Mon Sep 17 00:00:00 2001 From: cpradio Date: Mon, 1 Aug 2016 17:30:04 -0400 Subject: [PATCH] FEATURE: Installed Version link shows GitHub Compare to branch being followed --- app/assets/javascripts/admin/models/version-check.js.es6 | 5 ++++- app/models/discourse_version_check.rb | 2 +- lib/discourse_updates.rb | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/admin/models/version-check.js.es6 b/app/assets/javascripts/admin/models/version-check.js.es6 index fc8c1bf5e22..60e34394907 100644 --- a/app/assets/javascripts/admin/models/version-check.js.es6 +++ b/app/assets/javascripts/admin/models/version-check.js.es6 @@ -24,8 +24,11 @@ const VersionCheck = Discourse.Model.extend({ }.property('missing_versions_count'), gitLink: function() { + const git_branch = this.get('git_branch'); + if (git_branch) + return "https://github.com/discourse/discourse/compare/" + this.get('installed_sha') + "..." + git_branch; return "https://github.com/discourse/discourse/tree/" + this.get('installed_sha'); - }.property('installed_sha'), + }.property('installed_sha', 'git_branch'), shortSha: function() { return this.get('installed_sha').substr(0,10); diff --git a/app/models/discourse_version_check.rb b/app/models/discourse_version_check.rb index c1be79fcd95..91aabe84c6a 100644 --- a/app/models/discourse_version_check.rb +++ b/app/models/discourse_version_check.rb @@ -1,5 +1,5 @@ class DiscourseVersionCheck include ActiveModel::Model - attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :installed_describe, :missing_versions_count, :updated_at, :version_check_pending + attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :installed_describe, :missing_versions_count, :git_branch, :updated_at, :version_check_pending end diff --git a/lib/discourse_updates.rb b/lib/discourse_updates.rb index cb845714e12..61df22e2aa3 100644 --- a/lib/discourse_updates.rb +++ b/lib/discourse_updates.rb @@ -8,6 +8,7 @@ module DiscourseUpdates installed_version: Discourse::VERSION::STRING, installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version), installed_describe: `git describe --dirty`, + git_branch: Discourse.git_branch, updated_at: nil ) else @@ -18,6 +19,7 @@ module DiscourseUpdates installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version), installed_describe: `git describe --dirty`, missing_versions_count: missing_versions_count, + git_branch: Discourse.git_branch, updated_at: updated_at ) end