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
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2016-04-07 21:20:41 +0300
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2016-04-07 21:20:41 +0300
commit37cdfe4f43225508f48f6352c0018c2ff508e8e8 (patch)
tree0d0c8f23580dcf2d8f8e9f3f51dca5a41e3c9e27
parent673c4ec8e074efd24e96f09b0efbe1a9ddb039b3 (diff)
Award Emoji are also copied to the new location when moved
-rw-r--r--app/models/note.rb2
-rw-r--r--app/services/issues/move_service.rb10
-rw-r--r--app/views/projects/notes/_note.html.haml3
3 files changed, 11 insertions, 4 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 84edfafba68..1697ed78f1c 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -27,8 +27,6 @@ class Note < ActiveRecord::Base
include Mentionable
include Awardable
- attr_accessor :award_emoji
-
default_value_for :system, false
attr_mentionable :note, cache: true, pipeline: :note
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb
index 82e7090f1ea..e7088c0bb4f 100644
--- a/app/services/issues/move_service.rb
+++ b/app/services/issues/move_service.rb
@@ -24,6 +24,7 @@ module Issues
@new_issue = create_new_issue
rewrite_notes
+ rewrite_award_emoji(issue, @new_issue)
add_note_moved_from
# Old issue tasks
@@ -58,6 +59,15 @@ module Issues
updated_at: note.updated_at }
new_note.update(new_params)
+ rewrite_award_emoji(note, new_note)
+ end
+ end
+
+ def rewrite_award_emoji(awardable, new_awardable)
+ awardable.award_emoji.each do |award|
+ new_award = award.dup
+ new_award.awardable = new_awardable
+ new_award.save
end
end
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index d326acf9c41..3cbbdf78fb9 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -11,8 +11,7 @@
= link_to '#', title: 'Award emoji', class: 'note-award-control js-add-award', data: { award_menu_url: emojis_path, position: "right" } do
= icon('smile-o', {class: "award-control-icon award-control-icon-normal"})
= icon('spinner spin', {class: "award-control-icon award-control-icon-loading"})
- - if note_editable?(note)
- = link_to '#', title: 'Edit comment', class: 'js-note-edit' do
+
= link_to_member(note.project, note.author, avatar: false)
.inline.note-headline-light
= "#{note.author.to_reference} commented"