mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-02 22:00:34 +01:00
closes #6536
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
"mubsub-nbb": "^1.5.0",
|
||||
"nconf": "^0.10.0",
|
||||
"nodebb-plugin-composer-default": "6.0.26",
|
||||
"nodebb-plugin-dbsearch": "2.0.17",
|
||||
"nodebb-plugin-dbsearch": "2.0.18",
|
||||
"nodebb-plugin-emoji": "^2.2.2",
|
||||
"nodebb-plugin-emoji-android": "2.0.0",
|
||||
"nodebb-plugin-markdown": "8.4.3",
|
||||
|
||||
@@ -38,7 +38,7 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo
|
||||
searchData.term = $('#search-input').val();
|
||||
if (searchData.in === 'posts' || searchData.in === 'titlesposts' || searchData.in === 'titles') {
|
||||
searchData.matchWords = form.find('#match-words-filter').val();
|
||||
searchData.by = form.find('#posted-by-user').val();
|
||||
searchData.by = form.find('#posted-by-user').tagsinput('items');
|
||||
searchData.categories = form.find('#posted-in-categories').val();
|
||||
searchData.searchChildren = form.find('#search-children').is(':checked');
|
||||
searchData.hasTags = form.find('#has-tags').tagsinput('items');
|
||||
@@ -85,7 +85,10 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo
|
||||
}
|
||||
|
||||
if (formData.by) {
|
||||
$('#posted-by-user').val(formData.by);
|
||||
formData.by = Array.isArray(formData.by) ? formData.by : [formData.by];
|
||||
formData.by.forEach(function (by) {
|
||||
$('#posted-by-user').tagsinput('add', by);
|
||||
});
|
||||
}
|
||||
|
||||
if (formData.categories) {
|
||||
@@ -176,7 +179,12 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo
|
||||
}
|
||||
|
||||
function enableAutoComplete() {
|
||||
autocomplete.user($('#posted-by-user'));
|
||||
var userEl = $('#posted-by-user');
|
||||
userEl.tagsinput({
|
||||
confirmKeys: [13, 44],
|
||||
trimValue: true,
|
||||
});
|
||||
autocomplete.user(userEl.siblings('.bootstrap-tagsinput').find('input'));
|
||||
|
||||
var tagEl = $('#has-tags');
|
||||
tagEl.tagsinput({
|
||||
@@ -184,7 +192,7 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo
|
||||
trimValue: true,
|
||||
});
|
||||
|
||||
autocomplete.tag($('#has-tags').siblings('.bootstrap-tagsinput').find('input'));
|
||||
autocomplete.tag(tagEl.siblings('.bootstrap-tagsinput').find('input'));
|
||||
}
|
||||
|
||||
return Search;
|
||||
|
||||
@@ -12,7 +12,9 @@ define('autocomplete', function () {
|
||||
open: function () {
|
||||
$(this).autocomplete('widget').css('z-index', 100005);
|
||||
},
|
||||
select: onselect,
|
||||
select: function (event, ui) {
|
||||
handleOnSelect(input, onselect, event, ui);
|
||||
},
|
||||
source: function (request, response) {
|
||||
socket.emit('user.search', {
|
||||
query: request.term,
|
||||
@@ -90,14 +92,7 @@ define('autocomplete', function () {
|
||||
$(this).autocomplete('widget').css('z-index', 20000);
|
||||
},
|
||||
select: function (event, ui) {
|
||||
onselect = onselect || function () {};
|
||||
var e = jQuery.Event('keypress');
|
||||
e.which = 13;
|
||||
e.keyCode = 13;
|
||||
setTimeout(function () {
|
||||
input.trigger(e);
|
||||
}, 100);
|
||||
onselect(event, ui);
|
||||
handleOnSelect(input, onselect, event, ui);
|
||||
},
|
||||
source: function (request, response) {
|
||||
socket.emit('topics.autocompleteTags', {
|
||||
@@ -117,5 +112,16 @@ define('autocomplete', function () {
|
||||
});
|
||||
};
|
||||
|
||||
function handleOnSelect(input, onselect, event, ui) {
|
||||
onselect = onselect || function () {};
|
||||
var e = jQuery.Event('keypress');
|
||||
e.which = 13;
|
||||
e.keyCode = 13;
|
||||
setTimeout(function () {
|
||||
input.trigger(e);
|
||||
}, 100);
|
||||
onselect(event, ui);
|
||||
}
|
||||
|
||||
return module;
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ define('search', ['navigator', 'translator', 'storage'], function (nav, translat
|
||||
query.matchWords = data.matchWords;
|
||||
}
|
||||
|
||||
if (postedBy && (searchIn === 'posts' || searchIn === 'titles' || searchIn === 'titlesposts')) {
|
||||
if (postedBy && postedBy.length && (searchIn === 'posts' || searchIn === 'titles' || searchIn === 'titlesposts')) {
|
||||
query.by = postedBy;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user