Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-01-11 10:57:57 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-01-11 10:57:57 +0300
commitc90fcf1a29bd37ab2122bd8c03668cff79c29aa3 (patch)
treed91515e17b128110d43067f624a9e975bccaef80 /app
parentb10ea6e386a025759aca5e9ef0d23931e77d1012 (diff)
parent95865da5499a794c539d43b1adfb33d98da97ba2 (diff)
Merge branch 'sh-fix-award-emoji-move-issues' into 'master'
Fix bug where award emojis would be lost when moving issues between projects Closes #33423 See merge request gitlab-org/gitlab-ce!16377
Diffstat (limited to 'app')
-rw-r--r--app/services/issues/move_service.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb
index 29def25719d..2f511ab44b7 100644
--- a/app/services/issues/move_service.rb
+++ b/app/services/issues/move_service.rb
@@ -24,7 +24,7 @@ module Issues
@new_issue = create_new_issue
rewrite_notes
- rewrite_award_emoji
+ rewrite_issue_award_emoji
add_note_moved_from
# Old issue tasks
@@ -76,7 +76,7 @@ module Issues
end
def rewrite_notes
- @old_issue.notes.find_each do |note|
+ @old_issue.notes_with_associations.find_each do |note|
new_note = note.dup
new_params = { project: @new_project, noteable: @new_issue,
note: rewrite_content(new_note.note),
@@ -84,13 +84,19 @@ module Issues
updated_at: note.updated_at }
new_note.update(new_params)
+
+ rewrite_award_emoji(note, new_note)
end
end
- def rewrite_award_emoji
- @old_issue.award_emoji.each do |award|
+ def rewrite_issue_award_emoji
+ rewrite_award_emoji(@old_issue, @new_issue)
+ end
+
+ def rewrite_award_emoji(old_awardable, new_awardable)
+ old_awardable.award_emoji.each do |award|
new_award = award.dup
- new_award.awardable = @new_issue
+ new_award.awardable = new_awardable
new_award.save
end
end