FIX: tag search should not be case sensitive

This commit is contained in:
Neil Lalonde 2016-09-09 16:55:26 -04:00
parent e78b7a243e
commit b381d84dd9
2 changed files with 2 additions and 1 deletions

View File

@ -77,7 +77,7 @@ export default Ember.TextField.extend({
callback(data);
},
createSearchChoice: function(term, data) {
term = term.replace(filterRegexp, '').trim();
term = term.replace(filterRegexp, '').trim().toLowerCase();
// No empty terms, make sure the user has permission to create the tag
if (!term.length || !self.get('allowCreate') || self.get('termMatchesForbidden')) return;

View File

@ -56,6 +56,7 @@ module DiscourseTagging
def self.filter_allowed_tags(query, guardian, opts={})
term = opts[:term]
if term.present?
term.downcase!
term.gsub!(/[^a-z0-9\.\-\_]*/, '')
term.gsub!("_", "\\_")
query = query.where('tags.name like ?', "%#{term}%")