Commit 8d2de73a authored by James Edwards-Jones's avatar James Edwards-Jones

fixup! Added link to bulk assign issues to MR author. (Issue #18876)

parent 492b4332
...@@ -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
......
...@@ -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
......
...@@ -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
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