* feat: add type to privilege maps

deprecate old hooks that are used for adding new privileges, new hooks are static:privileges.global.init/static:privileges.categories.init

* deprecate admin priv hooks

* fix: if type doesnt exist default to 'other'

* remove filter

* fix: copy privilege functions to use new filter instead of indices

allow static hooks to use sync functions

* fix: openapi

* test: fix template helper
This commit is contained in:
Barış Soner Uşaklı
2023-09-25 20:42:18 -04:00
committed by GitHub
parent c1f873b302
commit f1a80d48cc
15 changed files with 607 additions and 402 deletions

View File

@@ -173,13 +173,14 @@ module.exports = function (utils, Benchpress, relative_path) {
return '';
}
function spawnPrivilegeStates(member, privileges) {
function spawnPrivilegeStates(member, privileges, types) {
const states = [];
for (const priv in privileges) {
if (privileges.hasOwnProperty(priv)) {
states.push({
name: priv,
state: privileges[priv],
type: types[priv],
});
}
}
@@ -193,7 +194,7 @@ module.exports = function (utils, Benchpress, relative_path) {
(member === 'Global Moderators' && globalModDisabled.includes(priv.name));
return `
<td data-privilege="${priv.name}" data-value="${priv.state}">
<td data-privilege="${priv.name}" data-value="${priv.state}" data-type="${priv.type}">
<div class="form-check text-center">
<input class="form-check-input float-none" autocomplete="off" type="checkbox"${(priv.state ? ' checked' : '')}${(disabled ? ' disabled="disabled"' : '')} />
</div>