Merge branch '41949-move' into 'master'

Remember assignee when moving an issue

See merge request gitlab-org/gitlab-ce!17116
This commit is contained in:
Douwe Maan 2018-02-19 08:49:52 +00:00
commit 637ab60c60
3 changed files with 29 additions and 1 deletions

View file

@ -48,7 +48,8 @@ module Issues
new_params = { id: nil, iid: nil, label_ids: cloneable_label_ids,
milestone_id: cloneable_milestone_id,
project: @new_project, author: @old_issue.author,
description: rewrite_content(@old_issue.description) }
description: rewrite_content(@old_issue.description),
assignee_ids: @old_issue.assignee_ids }
new_params = @old_issue.serializable_hash.symbolize_keys.merge(new_params)
CreateService.new(@new_project, @current_user, new_params).execute

View file

@ -0,0 +1,5 @@
---
title: Remember assignee when moving an issue
merge_request:
author:
type: fixed

View file

@ -232,6 +232,28 @@ describe Issues::MoveService do
end
end
context 'issue with assignee' do
let(:assignee) { create(:user) }
before do
old_issue.assignees = [assignee]
end
it 'preserves assignee with access to the new issue' do
new_project.add_reporter(assignee)
new_issue = move_service.execute(old_issue, new_project)
expect(new_issue.assignees).to eq([assignee])
end
it 'ignores assignee without access to the new issue' do
new_issue = move_service.execute(old_issue, new_project)
expect(new_issue.assignees).to be_empty
end
end
context 'notes with references' do
before do
create(:merge_request, source_project: old_project)