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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
8d2de73a
Commit
8d2de73a
authored
Oct 07, 2016
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Added link to bulk assign issues to MR author. (Issue #18876)
parent
492b4332
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-0
app/services/merge_requests/assign_issues_service.rb
app/services/merge_requests/assign_issues_service.rb
+3
-3
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+17
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
8d2de73a
...
@@ -29,6 +29,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -29,6 +29,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
# Allow modify merge_request
# Allow modify merge_request
before_action
:authorize_update_merge_request!
,
only:
[
:close
,
:edit
,
:update
,
:remove_wip
,
:sort
]
before_action
:authorize_update_merge_request!
,
only:
[
:close
,
:edit
,
:update
,
:remove_wip
,
:sort
]
before_action
:authenticate_user!
,
only:
[
:assign_related_issues
]
before_action
:authorize_can_resolve_conflicts!
,
only:
[
:conflicts
,
:resolve_conflicts
]
before_action
:authorize_can_resolve_conflicts!
,
only:
[
:conflicts
,
:resolve_conflicts
]
def
index
def
index
...
...
app/services/merge_requests/assign_issues_service.rb
View file @
8d2de73a
...
@@ -3,9 +3,9 @@ module MergeRequests
...
@@ -3,9 +3,9 @@ module MergeRequests
def
assignable_issues
def
assignable_issues
@assignable_issues
||=
begin
@assignable_issues
||=
begin
if
current_user
==
merge_request
.
author
if
current_user
==
merge_request
.
author
closes_issues
.
closes_issues
.
select
do
|
issue
|
reject
{
|
issue
|
issue
.
assignee_id?
}.
!
issue
.
assignee_id?
&&
can?
(
current_user
,
:admin_issue
,
issue
)
select
{
|
issue
|
can?
(
current_user
,
:admin_issue
,
issue
)
}
end
else
else
[]
[]
end
end
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
8d2de73a
...
@@ -738,5 +738,22 @@ describe Projects::MergeRequestsController do
...
@@ -738,5 +738,22 @@ describe Projects::MergeRequestsController do
expect
(
flash
[
:notice
]).
to
eq
'1 issue has been assigned to you'
expect
(
flash
[
:notice
]).
to
eq
'1 issue has been assigned to you'
end
end
it
'calls MergeRequests::AssignIssuesService'
do
expect
(
MergeRequests
::
AssignIssuesService
).
to
receive
(
:new
).
with
(
project
,
user
,
merge_request:
merge_request
).
and_return
(
double
(
execute:
{
count:
1
}))
post_assign_issues
end
it
'is skipped when not signed in'
do
project
.
update!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
sign_out
(
:user
)
expect
(
MergeRequests
::
AssignIssuesService
).
not_to
receive
(
:new
)
post_assign_issues
end
end
end
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