Merge branch 'comment-case-insensetive-search' into 'master'

Case-insensitive search for comments

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

See merge request !1174
This commit is contained in:
Dmitriy Zaporozhets 2015-08-21 14:53:36 +00:00
commit 59525d6b28
3 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@ v 8.0.0 (unreleased)
- Ability to fetch merge requests from refs/merge-requests/:id
- Allow displaying of archived projects in the admin interface (Artem Sidorenko)
- Allow configuration of import sources for new projects (Artem Sidorenko)
- 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)

View File

@ -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

View File

@ -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