diff options
author | Long Nguyen <long.polyglot@gmail.com> | 2016-04-26 23:20:19 +0700 |
---|---|---|
committer | Long Nguyen <long.polyglot@gmail.com> | 2016-04-26 23:20:19 +0700 |
commit | 247ae960552acc8cd3be299dbb10ed61d8dafe75 (patch) | |
tree | 60bbeaa2355e67a63fbed2575064e4ac481a3f4b /app | |
parent | df8fda60fbbd2b6b38bdcb1680a0f24598c29f79 (diff) | |
download | gitlab-ce-247ae960552acc8cd3be299dbb10ed61d8dafe75.tar.gz |
Allow to assign labels and milestone to target project when moving issue
Diffstat (limited to 'app')
-rw-r--r-- | app/services/issues/move_service.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index 82e7090f1ea..8d41ea5df55 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -41,7 +41,8 @@ module Issues private def create_new_issue - new_params = { id: nil, iid: nil, label_ids: [], milestone: nil, + new_params = { id: nil, iid: nil, label_ids: cloneable_label_ids, + milestone: cloneable_milestone_id, project: @new_project, author: @old_issue.author, description: rewrite_content(@old_issue.description) } @@ -49,6 +50,14 @@ module Issues CreateService.new(@new_project, @current_user, new_params).execute end + def cloneable_label_ids + @new_project.labels.where(title: @old_issue.labels.pluck(:title)).pluck(:id) + end + + def cloneable_milestone_id + @new_project.milestones.find_by(title: @old_issue.milestone.try(:title)) + end + def rewrite_notes @old_issue.notes.find_each do |note| new_note = note.dup |