Skip to content

Commit

Permalink
Adds version to about/more and API (mastodon#2181)
Browse files Browse the repository at this point in the history
* Adds version.

* Cleans up code.

* Removes standalone endpoint and adds version to instance endpoint.

* Addresses feedback from mastodon#2181.
  • Loading branch information
ashfurrow authored and Gargron committed Apr 21, 2017
1 parent 25d2853 commit a0ed88a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/presenters/instance_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ def status_count
def domain_count
Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) }
end

def version_number
Mastodon::VERSION
end
end
4 changes: 4 additions & 0 deletions app/views/about/_version.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.panel
.panel-header= t 'about.version'
.panel-body
%strong= version.version_number
1 change: 1 addition & 0 deletions app/views/about/more.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
.sidebar
= render 'contact', contact: @instance_presenter
= render 'links'
= render 'version', version: @instance_presenter
1 change: 1 addition & 0 deletions app/views/api/v1/instances/show.rabl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node(:uri) { site_hostname }
node(:title) { Setting.site_title }
node(:description) { Setting.site_description }
node(:email) { Setting.site_contact_email }
node(:version) { Mastodon::VERSION }
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require_relative '../app/lib/exceptions'
require_relative '../lib/paperclip/gif_transcoder'
require_relative '../lib/paperclip/video_transcoder'
require_relative '../lib/mastodon/version'

Dotenv::Railtie.load

Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ en:
terms: Terms
user_count_after: users
user_count_before: Home to
version: Version
accounts:
follow: Follow
followers: Followers
Expand Down
5 changes: 5 additions & 0 deletions lib/mastodon/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module Mastodon
VERSION = '1.2.2'
end

0 comments on commit a0ed88a

Please sign in to comment.