Commit b7e6ae03 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Case-insensetive search for comments

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 3659d3b5
...@@ -5,6 +5,7 @@ v 8.0.0 (unreleased) ...@@ -5,6 +5,7 @@ v 8.0.0 (unreleased)
- Better performance for web editor (switched from satellites to rugged) - Better performance for web editor (switched from satellites to rugged)
- Faster merge - Faster merge
- Ability to fetch merge requests from refs/merge-requests/:id - Ability to fetch merge requests from refs/merge-requests/:id
- Search for comments should be case insensetive
v 7.14.0 (unreleased) v 7.14.0 (unreleased)
- Update default robots.txt rules to disallow crawling of irrelevant pages (Ben Bodenmiller) - Update default robots.txt rules to disallow crawling of irrelevant pages (Ben Bodenmiller)
......
...@@ -90,7 +90,7 @@ class Note < ActiveRecord::Base ...@@ -90,7 +90,7 @@ class Note < ActiveRecord::Base
end end
def search(query) def search(query)
where("note like :query", query: "%#{query}%") where("LOWER(note) like :query", query: "%#{query.downcase}%")
end end
end end
......
...@@ -198,4 +198,10 @@ describe Note do ...@@ -198,4 +198,10 @@ describe Note do
let(:backref_text) { issue.gfm_reference } let(:backref_text) { issue.gfm_reference }
let(:set_mentionable_text) { ->(txt) { subject.note = txt } } let(:set_mentionable_text) { ->(txt) { subject.note = txt } }
end end
describe :search do
let!(:note) { create(:note, note: "WoW") }
it { expect(Note.search('wow')).to include(note) }
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