Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 12:55:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 12:55:51 +0300
commite8d2c2579383897a1dd7f9debd359abe8ae8373d (patch)
treec42be41678c2586d49a75cabce89322082698334 /app/controllers/projects/runners_controller.rb
parentfc845b37ec3a90aaa719975f607740c22ba6a113 (diff)
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'app/controllers/projects/runners_controller.rb')
-rw-r--r--app/controllers/projects/runners_controller.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb
index ec1f57f090a..e841c3e3d49 100644
--- a/app/controllers/projects/runners_controller.rb
+++ b/app/controllers/projects/runners_controller.rb
@@ -6,7 +6,7 @@ class Projects::RunnersController < Projects::ApplicationController
layout 'project_settings'
- feature_category :continuous_integration
+ feature_category :runner
def index
redirect_to project_settings_ci_cd_path(@project, anchor: 'js-runners-settings')
@@ -51,14 +51,14 @@ class Projects::RunnersController < Projects::ApplicationController
end
def toggle_shared_runners
- if !project.shared_runners_enabled && project.group && project.group.shared_runners_setting == 'disabled_and_unoverridable'
- render json: { error: _('Cannot enable shared runners because parent group does not allow it') }, status: :unauthorized
- return
- end
-
- project.toggle!(:shared_runners_enabled)
+ update_params = { shared_runners_enabled: !project.shared_runners_enabled }
+ result = Projects::UpdateService.new(project, current_user, update_params).execute
- render json: {}, status: :ok
+ if result[:status] == :success
+ render json: {}, status: :ok
+ else
+ render json: { error: result[:message] }, status: :unauthorized
+ end
end
def toggle_group_runners