mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-21 23:12:58 +01:00
fix: update userFilter to allow new option selectedBlock
This commit is contained in:
@@ -43,7 +43,8 @@ define('forum/flags/list', [
|
||||
const filterEl = $(`[component="flags/filter/${filter}"]`);
|
||||
userFilter.init(filterEl, {
|
||||
selectedUsers: selected.get(filter),
|
||||
template: 'partials/search-filters',
|
||||
template: 'partials/flags/filters',
|
||||
selectedBlock: 'selected.assignee',
|
||||
onSelect: function (_selectedUsers) {
|
||||
selected.set(filter, _selectedUsers);
|
||||
},
|
||||
|
||||
@@ -16,9 +16,16 @@ define('userFilter', ['api', 'hooks', 'slugify'], function (api, hooks, slugify)
|
||||
hooks.fire('action:user.filter.options', { el: el, options: options });
|
||||
|
||||
async function renderSelectedUsers() {
|
||||
const html = await app.parseAndTranslate(options.template, 'userFilterSelected', {
|
||||
userFilterSelected: selectedUsers,
|
||||
});
|
||||
const block = options.selectedBlock || 'userFilterSelected';
|
||||
const payload = {};
|
||||
if (block.indexOf('.') !== -1) {
|
||||
const split = block.split('.');
|
||||
payload[split[0]] = {};
|
||||
payload[split[0]][split[1]] = selectedUsers;
|
||||
} else {
|
||||
payload[block] = selectedUsers;
|
||||
}
|
||||
const html = await app.parseAndTranslate(options.template, block, payload);
|
||||
el.find('[component="user/filter/selected"]').html(html);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user