Commit 3026cb20 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'jej-rename-legacy-protected-branches-api-service' into 'master'

Renamed ProtectedBranches::ApiUpdateService to LegacyApiUpdateService

See merge request gitlab-org/gitlab-ce!15575
parents 505cba59 fceffe4d
# The protected branches API still uses the `developers_can_push` and `developers_can_merge` # The branches#protect API still uses the `developers_can_push` and `developers_can_merge`
# flags for backward compatibility, and so performs translation between that format and the # flags for backward compatibility, and so performs translation between that format and the
# internal data model (separate access levels). The translation code is non-trivial, and so # internal data model (separate access levels). The translation code is non-trivial, and so
# lives in this service. # lives in this service.
module ProtectedBranches module ProtectedBranches
class ApiCreateService < BaseService class LegacyApiCreateService < BaseService
def execute def execute
push_access_level = push_access_level =
if params.delete(:developers_can_push) if params.delete(:developers_can_push)
......
# The protected branches API still uses the `developers_can_push` and `developers_can_merge` # The branches#protect API still uses the `developers_can_push` and `developers_can_merge`
# flags for backward compatibility, and so performs translation between that format and the # flags for backward compatibility, and so performs translation between that format and the
# internal data model (separate access levels). The translation code is non-trivial, and so # internal data model (separate access levels). The translation code is non-trivial, and so
# lives in this service. # lives in this service.
module ProtectedBranches module ProtectedBranches
class ApiUpdateService < BaseService class LegacyApiUpdateService < BaseService
def execute(protected_branch) def execute(protected_branch)
@developers_can_push = params.delete(:developers_can_push) @developers_can_push = params.delete(:developers_can_push)
@developers_can_merge = params.delete(:developers_can_merge) @developers_can_merge = params.delete(:developers_can_merge)
......
...@@ -81,9 +81,9 @@ module API ...@@ -81,9 +81,9 @@ module API
service_args = [user_project, current_user, protected_branch_params] service_args = [user_project, current_user, protected_branch_params]
protected_branch = if protected_branch protected_branch = if protected_branch
::ProtectedBranches::ApiUpdateService.new(*service_args).execute(protected_branch) ::ProtectedBranches::LegacyApiUpdateService.new(*service_args).execute(protected_branch)
else else
::ProtectedBranches::ApiCreateService.new(*service_args).execute ::ProtectedBranches::LegacyApiCreateService.new(*service_args).execute
end end
if protected_branch.valid? if protected_branch.valid?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment