mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #8290, if there are no filters go to ?reset=1
dont count ?page=1 as a filter
This commit is contained in:
@@ -23,7 +23,7 @@ define('forum/flags/list', ['components', 'Chart'], function (components, Chart)
|
||||
var payload = filtersEl.serializeArray().filter(function (item) {
|
||||
return !!item.value;
|
||||
});
|
||||
ajaxify.go('flags?' + $.param(payload));
|
||||
ajaxify.go('flags?' + (payload.length ? $.param(payload) : 'reset=1'));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -66,7 +66,10 @@ modsController.flags.list = async function (req, res, next) {
|
||||
}
|
||||
|
||||
// Pagination doesn't count as a filter
|
||||
if (Object.keys(filters).length === 2 && filters.hasOwnProperty('page') && filters.hasOwnProperty('perPage')) {
|
||||
if (
|
||||
(Object.keys(filters).length === 1 && filters.hasOwnProperty('page')) ||
|
||||
(Object.keys(filters).length === 2 && filters.hasOwnProperty('page') && filters.hasOwnProperty('perPage'))
|
||||
) {
|
||||
hasFilter = false;
|
||||
}
|
||||
|
||||
@@ -130,6 +133,7 @@ modsController.flags.detail = async function (req, res, next) {
|
||||
}, {}),
|
||||
title: '[[pages:flag-details, ' + req.params.flagId + ']]',
|
||||
categories: results.categories,
|
||||
filters: req.session.flags_filters || [],
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user