mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: check cid as well as template
This commit is contained in:
@@ -87,13 +87,13 @@ define('search', ['translator', 'storage', 'hooks', 'alerts'], function (transla
|
||||
const filterCategoryEl = quickSearchResults.find('.filter-category');
|
||||
|
||||
function updateCategoryFilterName() {
|
||||
if (ajaxify.data.template.category) {
|
||||
if (ajaxify.data.template.category && ajaxify.data.cid) {
|
||||
translator.translate('[[search:search-in-category, ' + ajaxify.data.name + ']]', function (translated) {
|
||||
const name = $('<div></div>').html(translated).text();
|
||||
filterCategoryEl.find('.name').text(name);
|
||||
});
|
||||
}
|
||||
filterCategoryEl.toggleClass('hidden', !ajaxify.data.template.category);
|
||||
filterCategoryEl.toggleClass('hidden', !(ajaxify.data.template.category && ajaxify.data.cid));
|
||||
}
|
||||
|
||||
function doSearch() {
|
||||
@@ -101,7 +101,7 @@ define('search', ['translator', 'storage', 'hooks', 'alerts'], function (transla
|
||||
options.searchOptions.term = inputEl.val();
|
||||
updateCategoryFilterName();
|
||||
|
||||
if (ajaxify.data.template.category) {
|
||||
if (ajaxify.data.template.category && ajaxify.data.cid) {
|
||||
if (filterCategoryEl.find('input[type="checkbox"]').is(':checked')) {
|
||||
options.searchOptions.categories = [ajaxify.data.cid];
|
||||
options.searchOptions.searchChildren = true;
|
||||
|
||||
Reference in New Issue
Block a user