diff options
-rw-r--r-- | app/models/note.rb | 5 | ||||
-rw-r--r-- | spec/models/note_spec.rb | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index d0f950d5924..b3809ad81e0 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -376,9 +376,6 @@ class Note < ActiveRecord::Base def set_award! return unless awards_supported? && contains_emoji_only? - # Responding with an emoji is not an award emoji if its on a diff comment - return if line_code - self.is_award = true self.note = award_emoji_name end @@ -386,7 +383,7 @@ class Note < ActiveRecord::Base private def awards_supported? - noteable.kind_of?(Issue) || noteable.is_a?(MergeRequest) + (noteable.kind_of?(Issue) || noteable.is_a?(MergeRequest)) && !for_diff_line? end def contains_emoji_only? diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 7a293490c51..e6da3724d33 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -212,7 +212,10 @@ describe Note, models: true do it "is not an award emoji when comment is on a diff" do note = create(:note, note: ":blowfish:", noteable: merge_request, line_code: "11d5d2e667e9da4f7f610f81d86c974b146b13bd_0_2") - expect(note.reload.note).to eq(":blowfish:") + note = note.reload + + expect(note.note).to eq(":blowfish:") + expect(note.is_award?).to be_falsy end end end |