debian-mirror-gitlab/app/controllers/instance_statistics/cohorts_controller.rb

20 lines
589 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
class InstanceStatistics::CohortsController < InstanceStatistics::ApplicationController
2018-11-20 20:47:30 +05:30
before_action :authenticate_usage_ping_enabled_or_admin!
2017-08-17 22:00:37 +05:30
def index
2018-03-17 18:26:18 +05:30
if Gitlab::CurrentSettings.usage_ping_enabled
2017-08-17 22:00:37 +05:30
cohorts_results = Rails.cache.fetch('cohorts', expires_in: 1.day) do
CohortsService.new.execute
end
@cohorts = CohortsSerializer.new.represent(cohorts_results)
end
end
2018-11-20 20:47:30 +05:30
def authenticate_usage_ping_enabled_or_admin!
render_404 unless Gitlab::CurrentSettings.usage_ping_enabled || current_user.admin?
end
2017-08-17 22:00:37 +05:30
end