diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-10 19:40:18 +0100 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-10 19:40:18 +0100 |
commit | b20f677baa94aaea1dbc3437c51abbfd6f0e1548 (patch) | |
tree | 2baa6a04f1e10deb920b63ea1a28b8f1cc8457a6 | |
parent | 746320cea769f8de33ba2b7f7d6980a911319edf (diff) | |
parent | e3ee46a13b91a6cefb0efb1841fb24afed37b674 (diff) | |
download | gitlab-ce-b20f677baa94aaea1dbc3437c51abbfd6f0e1548.tar.gz |
Merge remote-tracking branch 'origin/emoji_edit_disallow'
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/note.rb | 2 | ||||
-rw-r--r-- | spec/models/note_spec.rb | 17 |
3 files changed, 19 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 18a9d317cc4..750ee1016d8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -35,6 +35,7 @@ v 8.3.0 (unreleased) - Use new style for wiki - Use new style for milestone detail page - Fix sidebar tooltips when collapsed + - Prevent possible XSS attack with award-emoji v 8.2.3 - Fix application settings cache not expiring after changes (Stan Hu) diff --git a/app/models/note.rb b/app/models/note.rb index de9392adbf4..8f0efa8d4b7 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -350,7 +350,7 @@ class Note < ActiveRecord::Base end def editable? - !system? + !system? && !is_award end # Checks if note is an award added as a comment diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index cd3c868ecc5..5b6f177ebb2 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -142,4 +142,21 @@ describe Note, models: true do expect(Note.grouped_awards.first.last).to match_array(Note.all) end end + + describe "editable?" do + it "returns true" do + note = build(:note) + expect(note.editable?).to be_truthy + end + + it "returns false" do + note = build(:note, system: true) + expect(note.editable?).to be_falsy + end + + it "returns false" do + note = build(:note, is_award: true, note: "smiley") + expect(note.editable?).to be_falsy + end + end end |