Commit 11ed1cbb authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg
Browse files

Emoji reponses on diffs aren't award emoji

parent a33b63b7
......@@ -65,6 +65,7 @@ v 8.5.0 (unreleased)
- Ability to see and sort on vote count from Issues and MR lists
- Fix builds scheduler when first build in stage was allowed to fail
- User project limit is reached notice is hidden if the projects limit is zero
- Emoji comment on diffs are not award emoji
v 8.4.4
- Update omniauth-saml gem to 1.4.2
......
......@@ -375,6 +375,10 @@ def cross_reference_not_visible_for?(user)
#
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
......
......@@ -35,8 +35,8 @@
= render "projects/notes/diff_notes_with_reply", notes: comments, line: raw_diff_lines[index].text
- if last_line > 0
= render "projects/diffs/match_line", {line: "",
line_old: last_line, line_new: last_line, bottom: true, new_file: diff_file.new_file}
= render "projects/diffs/match_line", { line: "",
line_old: last_line, line_new: last_line, bottom: true, new_file: diff_file.new_file }
- if diff_file.diff.blank? && diff_file.mode_changed?
.file-mode-changed
......
......@@ -203,11 +203,16 @@
end
describe "set_award!" do
let(:issue) { create :issue }
let(:merge_request) { create :merge_request }
it "converts aliases to actual name" do
note = create :note, note: ":+1:", noteable: issue
note = create(:note, note: ":+1:", noteable: merge_request)
expect(note.reload.note).to eq("thumbsup")
end
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:")
end
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment