feat: allow autocomplete to pass optional params to user.search

v1.18.x
psychobunny 4 years ago
parent f8032cd09b
commit 611f3c6155

@ -5,7 +5,12 @@
define('autocomplete', function () {
var module = {};
module.user = function (input, onselect) {
module.user = function (input, params, onselect) {
if (typeof params === 'function') {
onselect = params;
params = {};
}
app.loadJQueryUI(function () {
input.autocomplete({
delay: 200,
@ -16,10 +21,10 @@ define('autocomplete', function () {
handleOnSelect(input, onselect, event, ui);
},
source: function (request, response) {
socket.emit('user.search', {
query: request.term,
paginate: false,
}, function (err, result) {
params.query = params.query || request.term;
params.paginate = params.paginate || false;
socket.emit('user.search', params, function (err, result) {
if (err) {
return app.alertError(err.message);
}

Loading…
Cancel
Save