fix: #8290, if there are no filters go to ?reset=1

dont count ?page=1 as a filter
v1.18.x
Barış Soner Uşaklı 5 years ago
parent 2cf0a9b62d
commit 9839346ec3

@ -23,7 +23,7 @@ define('forum/flags/list', ['components', 'Chart'], function (components, Chart)
var payload = filtersEl.serializeArray().filter(function (item) { var payload = filtersEl.serializeArray().filter(function (item) {
return !!item.value; 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 // 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; hasFilter = false;
} }
@ -130,6 +133,7 @@ modsController.flags.detail = async function (req, res, next) {
}, {}), }, {}),
title: '[[pages:flag-details, ' + req.params.flagId + ']]', title: '[[pages:flag-details, ' + req.params.flagId + ']]',
categories: results.categories, categories: results.categories,
filters: req.session.flags_filters || [],
})); }));
}; };

Loading…
Cancel
Save