Make search dropdown filtering case-insensitive. closes flarum/core#961

This commit is contained in:
Toby Zerner 2016-08-28 00:00:20 +09:30
parent ddfc41c6f7
commit f07abda4e6
3 changed files with 12 additions and 0 deletions

View File

@ -21470,6 +21470,8 @@ System.register('flarum/components/DiscussionsSearchSource', ['flarum/helpers/hi
value: function search(query) {
var _this = this;
query = query.toLowerCase();
this.results[query] = [];
var params = {
@ -21485,6 +21487,8 @@ System.register('flarum/components/DiscussionsSearchSource', ['flarum/helpers/hi
}, {
key: 'view',
value: function view(query) {
query = query.toLowerCase();
var results = this.results[query] || [];
return [m(
@ -28066,6 +28070,8 @@ System.register('flarum/components/UsersSearchSource', ['flarum/helpers/highligh
}, {
key: 'view',
value: function view(query) {
query = query.toLowerCase();
var results = app.store.all('users').filter(function (user) {
return user.username().toLowerCase().substr(0, query.length) === query;
});

View File

@ -13,6 +13,8 @@ export default class DiscussionsSearchSource {
}
search(query) {
query = query.toLowerCase();
this.results[query] = [];
const params = {
@ -25,6 +27,8 @@ export default class DiscussionsSearchSource {
}
view(query) {
query = query.toLowerCase();
const results = this.results[query] || [];
return [

View File

@ -17,6 +17,8 @@ export default class UsersSearchResults {
}
view(query) {
query = query.toLowerCase();
const results = app.store.all('users')
.filter(user => user.username().toLowerCase().substr(0, query.length) === query);