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
015c6602
Commit
015c6602
authored
Jan 23, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix controller group_ids and user_ids not recognized
parent
db6142a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
ee/app/services/ee/merge_requests/base_service.rb
ee/app/services/ee/merge_requests/base_service.rb
+4
-2
ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+16
-0
No files found.
ee/app/services/ee/merge_requests/base_service.rb
View file @
015c6602
...
...
@@ -32,11 +32,13 @@ module EE
params
[
:approval_rules_attributes
].
each
do
|
rule_attributes
|
if
rule_attributes
.
key?
(
:group_ids
)
rule_attributes
[
:group_ids
]
=
rule_attributes
[
:group_ids
]
&
group_ids
provided_group_ids
=
rule_attributes
[
:group_ids
].
map
(
&
:to_i
)
rule_attributes
[
:group_ids
]
=
provided_group_ids
&
group_ids
end
if
rule_attributes
.
key?
(
:user_ids
)
rule_attributes
[
:user_ids
]
=
rule_attributes
[
:user_ids
]
&
user_ids
provided_user_ids
=
rule_attributes
[
:user_ids
].
map
(
&
:to_i
)
rule_attributes
[
:user_ids
]
=
provided_user_ids
&
user_ids
end
end
end
...
...
ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
015c6602
...
...
@@ -163,6 +163,22 @@ describe Projects::MergeRequestsController do
expect
(
merge_request
.
reload
.
approvals_before_merge
).
to
eq
(
2
)
end
it
'creates rules'
do
users
=
create_list
(
:user
,
3
)
users
.
each
{
|
user
|
project
.
add_developer
(
user
)
}
update_merge_request
(
approval_rules_attributes:
[
{
name:
'foo'
,
user_ids:
users
.
map
(
&
:id
),
approvals_required:
3
}
])
expect
(
merge_request
.
reload
.
approval_rules
.
size
).
to
eq
(
1
)
rule
=
merge_request
.
reload
.
approval_rules
.
first
expect
(
rule
.
name
).
to
eq
(
'foo'
)
expect
(
rule
.
approvals_required
).
to
eq
(
3
)
end
end
context
'disabled'
do
...
...
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