diff options
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/admin/cohorts_controller.rb | 23 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 24 |
3 files changed, 27 insertions, 29 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 5ddeb9630ba..7960e5d64d0 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -208,7 +208,10 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController params[:application_setting][:import_sources]&.delete("") params[:application_setting][:restricted_visibility_levels]&.delete("") - params[:application_setting][:required_instance_ci_template] = nil if params[:application_setting][:required_instance_ci_template].blank? + + if params[:application_setting].key?(:required_instance_ci_template) + params[:application_setting][:required_instance_ci_template] = nil if params[:application_setting][:required_instance_ci_template].empty? + end remove_blank_params_for!(:elasticsearch_aws_secret_access_key, :eks_secret_access_key) @@ -217,9 +220,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController params.delete(:domain_denylist_raw) if params[:domain_denylist] params.delete(:domain_allowlist_raw) if params[:domain_allowlist] - params.require(:application_setting).permit( - visible_application_setting_attributes - ) + params[:application_setting].permit(visible_application_setting_attributes) end def recheck_user_consent? 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 diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index e397ecbadaf..700acc46d8d 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -2,9 +2,8 @@ class Admin::UsersController < Admin::ApplicationController include RoutableActions - include Analytics::UniqueVisitsHelper - before_action :user, except: [:index, :cohorts, :new, :create] + before_action :user, except: [:index, :new, :create] before_action :check_impersonation_availability, only: :impersonate before_action :ensure_destroy_prerequisites_met, only: [:destroy] before_action :check_ban_user_feature_flag, only: [:ban] @@ -14,7 +13,7 @@ class Admin::UsersController < Admin::ApplicationController PAGINATION_WITH_COUNT_LIMIT = 1000 def index - return redirect_to cohorts_admin_users_path if params[:tab] == 'cohorts' + return redirect_to admin_cohorts_path if params[:tab] == 'cohorts' @users = User.filter_items(params[:filter]).order_name_asc @users = @users.search_with_secondary_emails(params[:search_query]) if params[:search_query].present? @@ -24,11 +23,6 @@ class Admin::UsersController < Admin::ApplicationController @users = @users.without_count if paginate_without_count? end - def cohorts - @cohorts = load_cohorts - track_cohorts_visit - end - def show end @@ -376,20 +370,6 @@ class Admin::UsersController < Admin::ApplicationController def log_impersonation_event Gitlab::AppLogger.info(_("User %{current_user_username} has started impersonating %{username}") % { current_user_username: current_user.username, username: user.username }) end - - 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 Admin::UsersController.prepend_mod_with('Admin::UsersController') |