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
eecb6d2f
Commit
eecb6d2f
authored
Dec 17, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce diff with EE in ProtectedRefsController
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
4a10c813
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
app/controllers/projects/protected_branches_controller.rb
app/controllers/projects/protected_branches_controller.rb
+4
-0
app/controllers/projects/protected_refs_controller.rb
app/controllers/projects/protected_refs_controller.rb
+2
-2
app/controllers/projects/protected_tags_controller.rb
app/controllers/projects/protected_tags_controller.rb
+4
-0
No files found.
app/controllers/projects/protected_branches_controller.rb
View file @
eecb6d2f
...
@@ -15,6 +15,10 @@ class Projects::ProtectedBranchesController < Projects::ProtectedRefsController
...
@@ -15,6 +15,10 @@ class Projects::ProtectedBranchesController < Projects::ProtectedRefsController
@protected_ref
=
@project
.
protected_branches
.
find
(
params
[
:id
])
@protected_ref
=
@project
.
protected_branches
.
find
(
params
[
:id
])
end
end
def
access_levels
[
:merge_access_levels
,
:push_access_levels
]
end
def
protected_ref_params
def
protected_ref_params
params
.
require
(
:protected_branch
).
permit
(
:name
,
params
.
require
(
:protected_branch
).
permit
(
:name
,
merge_access_levels_attributes:
access_level_attributes
,
merge_access_levels_attributes:
access_level_attributes
,
...
...
app/controllers/projects/protected_refs_controller.rb
View file @
eecb6d2f
...
@@ -32,7 +32,7 @@ class Projects::ProtectedRefsController < Projects::ApplicationController
...
@@ -32,7 +32,7 @@ class Projects::ProtectedRefsController < Projects::ApplicationController
@protected_ref
=
update_service_class
.
new
(
@project
,
current_user
,
protected_ref_params
).
execute
(
@protected_ref
)
@protected_ref
=
update_service_class
.
new
(
@project
,
current_user
,
protected_ref_params
).
execute
(
@protected_ref
)
if
@protected_ref
.
valid?
if
@protected_ref
.
valid?
render
json:
@protected_ref
,
status: :ok
render
json:
@protected_ref
,
status: :ok
,
include:
access_levels
else
else
render
json:
@protected_ref
.
errors
,
status: :unprocessable_entity
render
json:
@protected_ref
.
errors
,
status: :unprocessable_entity
end
end
...
@@ -62,6 +62,6 @@ class Projects::ProtectedRefsController < Projects::ApplicationController
...
@@ -62,6 +62,6 @@ class Projects::ProtectedRefsController < Projects::ApplicationController
end
end
def
access_level_attributes
def
access_level_attributes
%i
(access_level id)
%i
[access_level id]
end
end
end
end
app/controllers/projects/protected_tags_controller.rb
View file @
eecb6d2f
...
@@ -15,6 +15,10 @@ class Projects::ProtectedTagsController < Projects::ProtectedRefsController
...
@@ -15,6 +15,10 @@ class Projects::ProtectedTagsController < Projects::ProtectedRefsController
@protected_ref
=
@project
.
protected_tags
.
find
(
params
[
:id
])
@protected_ref
=
@project
.
protected_tags
.
find
(
params
[
:id
])
end
end
def
access_levels
[
:create_access_levels
]
end
def
protected_ref_params
def
protected_ref_params
params
.
require
(
:protected_tag
).
permit
(
:name
,
create_access_levels_attributes:
access_level_attributes
)
params
.
require
(
:protected_tag
).
permit
(
:name
,
create_access_levels_attributes:
access_level_attributes
)
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