Browse Source

Adds version to about/more and API (#2181)

* Adds version.

* Cleans up code.

* Removes standalone endpoint and adds version to instance endpoint.

* Addresses feedback from #2181.
closed-social-glitch-2
Ash Furrow 7 years ago
committed by Eugen
parent
commit
a0ed88a99b
7 changed files with 17 additions and 0 deletions
  1. +4
    -0
      app/presenters/instance_presenter.rb
  2. +4
    -0
      app/views/about/_version.html.haml
  3. +1
    -0
      app/views/about/more.html.haml
  4. +1
    -0
      app/views/api/v1/instances/show.rabl
  5. +1
    -0
      config/application.rb
  6. +1
    -0
      config/locales/en.yml
  7. +5
    -0
      lib/mastodon/version.rb

+ 4
- 0
app/presenters/instance_presenter.rb View File

@ -25,4 +25,8 @@ class InstancePresenter
def domain_count def domain_count
Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) } Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) }
end end
def version_number
Mastodon::VERSION
end
end end

+ 4
- 0
app/views/about/_version.html.haml View File

@ -0,0 +1,4 @@
.panel
.panel-header= t 'about.version'
.panel-body
%strong= version.version_number

+ 1
- 0
app/views/about/more.html.haml View File

@ -30,3 +30,4 @@
.sidebar .sidebar
= render 'contact', contact: @instance_presenter = render 'contact', contact: @instance_presenter
= render 'links' = render 'links'
= render 'version', version: @instance_presenter

+ 1
- 0
app/views/api/v1/instances/show.rabl View File

@ -4,3 +4,4 @@ node(:uri) { site_hostname }
node(:title) { Setting.site_title } node(:title) { Setting.site_title }
node(:description) { Setting.site_description } node(:description) { Setting.site_description }
node(:email) { Setting.site_contact_email } node(:email) { Setting.site_contact_email }
node(:version) { Mastodon::VERSION }

+ 1
- 0
config/application.rb View File

@ -9,6 +9,7 @@ Bundler.require(*Rails.groups)
require_relative '../app/lib/exceptions' require_relative '../app/lib/exceptions'
require_relative '../lib/paperclip/gif_transcoder' require_relative '../lib/paperclip/gif_transcoder'
require_relative '../lib/paperclip/video_transcoder' require_relative '../lib/paperclip/video_transcoder'
require_relative '../lib/mastodon/version'
Dotenv::Railtie.load Dotenv::Railtie.load

+ 1
- 0
config/locales/en.yml View File

@ -29,6 +29,7 @@ en:
terms: Terms terms: Terms
user_count_after: users user_count_after: users
user_count_before: Home to user_count_before: Home to
version: Version
accounts: accounts:
follow: Follow follow: Follow
followers: Followers followers: Followers

+ 5
- 0
lib/mastodon/version.rb View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
module Mastodon
VERSION = '1.2.2'
end

Loading…
Cancel
Save