diff options
author | Rémy Coutable <remy@rymai.me> | 2018-05-16 20:39:29 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-16 20:39:29 +0200 |
commit | 8d024ba79a2e2a2f2d34f4ee678b496f0fbe64f9 (patch) | |
tree | e26b5fd39c31ad170e0059aa3106bfbb1d7f5aac /app | |
parent | 6d81905fafb23f20520eb5ffa46c94b18ccc8686 (diff) | |
download | gitlab-ce-8d024ba79a2e2a2f2d34f4ee678b496f0fbe64f9.tar.gz |
Backport changes from EE to minimize the CE/EE diff in Projects::Settings::IntegrationsController6020-extract-ee-specific-controller-lines
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/settings/integrations_controller.rb | 9 | ||||
-rw-r--r-- | app/models/project.rb | 10 |
2 files changed, 17 insertions, 2 deletions
diff --git a/app/controllers/projects/settings/integrations_controller.rb b/app/controllers/projects/settings/integrations_controller.rb index 1ff08cce8cb..d9fecfecc40 100644 --- a/app/controllers/projects/settings/integrations_controller.rb +++ b/app/controllers/projects/settings/integrations_controller.rb @@ -11,7 +11,14 @@ module Projects @hook = ProjectHook.new # Services - @services = @project.find_or_initialize_services + @services = @project.find_or_initialize_services(exceptions: service_exceptions) + end + + private + + # Returns a list of services that should be hidden from the list + def service_exceptions + @project.disabled_services.dup end end end diff --git a/app/models/project.rb b/app/models/project.rb index 534a0e630af..107ee5f9a7e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -998,7 +998,7 @@ class Project < ActiveRecord::Base available_services_names = Service.available_services_names - exceptions - available_services_names.map do |service_name| + available_services = available_services_names.map do |service_name| service = find_service(services, service_name) if service @@ -1015,6 +1015,14 @@ class Project < ActiveRecord::Base end end end + + available_services.reject do |service| + disabled_services.include?(service.to_param) + end + end + + def disabled_services + [] end def find_or_initialize_service(name) |