Class: Alchemy::Admin::UpdateChecksController

Inherits:
BaseController show all
Defined in:
app/controllers/alchemy/admin/update_checks_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#leave

Methods included from Modules

included, #module_definition_for, register_module

Methods included from Alchemy::AbilityHelper

#current_ability

Methods included from ConfigurationMethods

#configuration, #multi_language?, #multi_site?, #prefix_locale?

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/alchemy/admin/update_checks_controller.rb', line 4

def show
  authorize! :update_check, :alchemy_admin_dashboard

  if update_check_result[:update_available]
    render json: {
      status: false,
      latest_version: update_check_result[:latest_version],
      message: Alchemy.t("Update available")
    }
  else
    render json: {
      status: true,
      latest_version: update_check_result[:latest_version],
      message: Alchemy.t("Alchemy is up to date")
    }
  end

  expires_in cache_duration, public: true
rescue UpdateServiceUnavailable
  render json: {
    message: Alchemy.t("Update status unavailable")
  }, status: 503
end