diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/note.rb | 2 | ||||
-rw-r--r-- | spec/models/note_spec.rb | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index f6592f82215..ea5def6000e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ v 8.0.0 (unreleased) - Better performance for web editor (switched from satellites to rugged) - Faster merge - Ability to fetch merge requests from refs/merge-requests/:id + - Search for comments should be case insensetive v 7.14.0 (unreleased) - Update default robots.txt rules to disallow crawling of irrelevant pages (Ben Bodenmiller) diff --git a/app/models/note.rb b/app/models/note.rb index 913a8c00337..36cad8f583d 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -90,7 +90,7 @@ class Note < ActiveRecord::Base end def search(query) - where("note like :query", query: "%#{query}%") + where("LOWER(note) like :query", query: "%#{query.downcase}%") end end diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 250d1e2da80..331505a01b3 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -198,4 +198,10 @@ describe Note do let(:backref_text) { issue.gfm_reference } let(:set_mentionable_text) { ->(txt) { subject.note = txt } } end + + describe :search do + let!(:note) { create(:note, note: "WoW") } + + it { expect(Note.search('wow')).to include(note) } + end end |