diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 15:10:08 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 15:10:08 +0000 |
commit | ec4abad65d774cfc94110577589d44de5da825de (patch) | |
tree | c51897390fa0a749bcd414d1ee1c2007fa9c3ec7 /app/controllers/admin/cohorts_controller.rb | |
parent | 111e0ef1fa06e79adf73a34ebd14f71bfeb99bff (diff) | |
download | gitlab-ce-ec4abad65d774cfc94110577589d44de5da825de.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/admin/cohorts_controller.rb')
-rw-r--r-- | app/controllers/admin/cohorts_controller.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/app/controllers/admin/cohorts_controller.rb b/app/controllers/admin/cohorts_controller.rb index c29b5224b09..8163f062b62 100644 --- a/app/controllers/admin/cohorts_controller.rb +++ b/app/controllers/admin/cohorts_controller.rb @@ -1,11 +1,28 @@ # frozen_string_literal: true class Admin::CohortsController < Admin::ApplicationController + include Analytics::UniqueVisitsHelper + feature_category :devops_reports - # Backwards compatibility. Remove it and routing in 14.0 - # @see https://gitlab.com/gitlab-org/gitlab/-/issues/299303 def index - redirect_to cohorts_admin_users_path + @cohorts = load_cohorts + track_cohorts_visit + end + + private + + def load_cohorts + cohorts_results = Rails.cache.fetch('cohorts', expires_in: 1.day) do + CohortsService.new.execute + end + + CohortsSerializer.new.represent(cohorts_results) + end + + def track_cohorts_visit + if request.format.html? && request.headers['DNT'] != '1' + track_visit('i_analytics_cohorts') + end end end |