Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c77047b8
Commit
c77047b8
authored
Apr 29, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ServiceParams to IntegrationParams
parent
af91d563
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
20 deletions
+22
-20
app/controllers/admin/services_controller.rb
app/controllers/admin/services_controller.rb
+2
-2
app/controllers/concerns/integration_params.rb
app/controllers/concerns/integration_params.rb
+9
-8
app/controllers/concerns/integrations_actions.rb
app/controllers/concerns/integrations_actions.rb
+4
-3
app/controllers/projects/services_controller.rb
app/controllers/projects/services_controller.rb
+4
-4
ee/app/controllers/concerns/ee/integration_params.rb
ee/app/controllers/concerns/ee/integration_params.rb
+3
-3
No files found.
app/controllers/admin/services_controller.rb
View file @
c77047b8
# frozen_string_literal: true
class
Admin::ServicesController
<
Admin
::
ApplicationController
include
Service
Params
include
Integration
Params
before_action
:service
,
only:
[
:edit
,
:update
]
before_action
:disable_query_limiting
,
only:
[
:index
]
...
...
@@ -21,7 +21,7 @@ class Admin::ServicesController < Admin::ApplicationController
end
def
update
if
service
.
update
(
service_params
[
:service
])
if
service
.
update
(
integration_params
[
:integration
])
PropagateServiceTemplateWorker
.
perform_async
(
service
.
id
)
if
service
.
active?
# rubocop:disable CodeReuse/Worker
redirect_to
admin_application_settings_services_path
,
...
...
app/controllers/concerns/
service
_params.rb
→
app/controllers/concerns/
integration
_params.rb
View file @
c77047b8
# frozen_string_literal: true
module
Service
Params
module
Integration
Params
extend
ActiveSupport
::
Concern
ALLOWED_PARAMS_CE
=
[
...
...
@@ -79,22 +79,23 @@ module ServiceParams
# Parameters to ignore if no value is specified
FILTER_BLANK_PARAMS
=
[
:password
].
freeze
def
service
_params
def
integration
_params
dynamic_params
=
@service
.
event_channel_names
+
@service
.
event_names
# rubocop:disable Gitlab/ModuleWithInstanceVariables
service_params
=
params
.
permit
(
:id
,
service:
allowed_service_params
+
dynamic_params
)
return_value
=
params
.
permit
(
:id
,
integration:
allowed_integration_params
+
dynamic_params
)
param_values
=
return_value
[
:integration
]
if
service_params
[
:service
]
.
is_a?
(
ActionController
::
Parameters
)
if
param_values
.
is_a?
(
ActionController
::
Parameters
)
FILTER_BLANK_PARAMS
.
each
do
|
param
|
service_params
[
:service
].
delete
(
param
)
if
service_params
[
:service
]
[
param
].
blank?
param_values
.
delete
(
param
)
if
param_values
[
param
].
blank?
end
end
service_params
return_value
end
def
allowed_
service
_params
def
allowed_
integration
_params
ALLOWED_PARAMS_CE
end
end
ServiceParams
.
prepend_if_ee
(
'EE::Service
Params'
)
IntegrationParams
.
prepend_if_ee
(
'EE::Integration
Params'
)
app/controllers/concerns/integrations_actions.rb
View file @
c77047b8
...
...
@@ -4,7 +4,7 @@ module IntegrationsActions
extend
ActiveSupport
::
Concern
included
do
include
Service
Params
include
Integration
Params
before_action
:integration
,
only:
[
:edit
,
:update
,
:test
]
end
...
...
@@ -14,7 +14,7 @@ module IntegrationsActions
end
def
update
saved
=
integration
.
update
(
service_params
[
:service
])
saved
=
integration
.
update
(
integration_params
[
:integration
])
respond_to
do
|
format
|
format
.
html
do
...
...
@@ -49,7 +49,8 @@ module IntegrationsActions
private
def
integration
# Using instance variable `@service` still required as it's used in ServiceParams.
# Using instance variable `@service` still required as it's used in
# IntegrationParams.
# Should be removed once that is refactored to use `@integration`.
@integration
=
@service
||=
find_or_initialize_non_project_specific_integration
(
params
[
:id
])
# rubocop:disable Gitlab/ModuleWithInstanceVariables
end
...
...
app/controllers/projects/services_controller.rb
View file @
c77047b8
# frozen_string_literal: true
class
Projects::ServicesController
<
Projects
::
ApplicationController
include
Service
Params
include
Integration
Params
include
InternalRedirect
# Authorize
...
...
@@ -26,8 +26,8 @@ class Projects::ServicesController < Projects::ApplicationController
end
def
update
@service
.
attributes
=
service_params
[
:service
]
@service
.
inherit_from_id
=
nil
if
service_params
[
:service
][
:inherit_from_id
].
blank?
@service
.
attributes
=
integration_params
[
:integration
]
@service
.
inherit_from_id
=
nil
if
integration_params
[
:integration
][
:inherit_from_id
].
blank?
saved
=
@service
.
save
(
context: :manual_change
)
...
...
@@ -60,7 +60,7 @@ class Projects::ServicesController < Projects::ApplicationController
private
def
service_test_response
unless
@service
.
update
(
service_params
[
:service
])
unless
@service
.
update
(
integration_params
[
:integration
])
return
{
error:
true
,
message:
_
(
'Validations failed.'
),
service_response:
@service
.
errors
.
full_messages
.
join
(
','
),
test_failed:
false
}
end
...
...
ee/app/controllers/concerns/ee/
service
_params.rb
→
ee/app/controllers/concerns/ee/
integration
_params.rb
View file @
c77047b8
# frozen_string_literal: true
module
EE
module
Service
Params
module
Integration
Params
extend
::
Gitlab
::
Utils
::
Override
ALLOWED_PARAMS_EE
=
[
...
...
@@ -14,8 +14,8 @@ module EE
:vulnerabilities_issuetype
].
freeze
override
:allowed_
service
_params
def
allowed_
service
_params
override
:allowed_
integration
_params
def
allowed_
integration
_params
super
+
ALLOWED_PARAMS_EE
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment