Node.js based forum software built for the modern web
fix: remove some privs from fediverse in world category
Julian Lam6999bd68e20d
diff --git a/public/src/modules/helpers.common.js b/public/src/modules/helpers.common.jsindex e4f47ca031..a2b057669e 100644--- a/public/src/modules/helpers.common.js+++ b/public/src/modules/helpers.common.js@@ -175,7 +175,7 @@ module.exports = function (utils, Benchpress, relative_path) {return '';}- function spawnPrivilegeStates(member, privileges, types) {+ function spawnPrivilegeStates(cid, member, privileges, types) {const states = [];for (const priv in privileges) {if (privileges.hasOwnProperty(priv)) {@@ -189,8 +189,11 @@ module.exports = function (utils, Benchpress, relative_path) {return states.map(function (priv) {const guestDisabled = ['groups:moderate', 'groups:posts:upvote', 'groups:posts:downvote', 'groups:local:login', 'groups:group:create'];const spidersEnabled = ['groups:find', 'groups:read', 'groups:topics:read', 'groups:view:users', 'groups:view:tags', 'groups:view:groups'];- const fediverseEnabled = ['groups:view:users', 'groups:find', 'groups:read', 'groups:topics:read', 'groups:topics:create', 'groups:topics:reply', 'groups:topics:tag', 'groups:posts:edit', 'groups:posts:history', 'groups:posts:delete', 'groups:posts:upvote', 'groups:posts:downvote', 'groups:topics:delete'];const globalModDisabled = ['groups:moderate'];+ let fediverseEnabled = ['groups:view:users', 'groups:find', 'groups:read', 'groups:topics:read', 'groups:topics:create', 'groups:topics:reply', 'groups:topics:tag', 'groups:posts:edit', 'groups:posts:history', 'groups:posts:delete', 'groups:posts:upvote', 'groups:posts:downvote', 'groups:topics:delete'];+ if (cid === -1) {+ fediverseEnabled = fediverseEnabled.slice(4);+ }const disabled =(member === 'guests' && (guestDisabled.includes(priv.name) || priv.name.startsWith('groups:admin:'))) ||(member === 'spiders' && !spidersEnabled.includes(priv.name)) ||diff --git a/src/views/admin/partials/privileges/category.tpl b/src/views/admin/partials/privileges/category.tplindex 1d00a2babd..7bb2f92890 100644--- a/src/views/admin/partials/privileges/category.tpl+++ b/src/views/admin/partials/privileges/category.tpl@@ -54,7 +54,7 @@<input autocomplete="off" type="checkbox" class="form-check-input float-none checkbox-helper"></div></td>- {function.spawnPrivilegeStates, privileges.groups.name, ../privileges, ../types}+ {function.spawnPrivilegeStates, cid, privileges.groups.name, ../privileges, ../types}</tr>{{{ end }}}</tbody>@@ -133,7 +133,7 @@<input autocomplete="off" type="checkbox" class="form-check-input float-none checkbox-helper"></div></td>- {function.spawnPrivilegeStates, privileges.users.username, ../privileges, ../types}+ {function.spawnPrivilegeStates, cid, privileges.users.username, ../privileges, ../types}</tr>{{{ end }}}</tbody>diff --git a/src/views/admin/partials/privileges/global.tpl b/src/views/admin/partials/privileges/global.tplindex 1bff0786bb..778afa8699 100644--- a/src/views/admin/partials/privileges/global.tpl+++ b/src/views/admin/partials/privileges/global.tpl@@ -41,7 +41,7 @@</td><td></td><td class="text-center"><input autocomplete="off" type="checkbox" class="checkbox-helper"></td>- {function.spawnPrivilegeStates, privileges.groups.name, ../privileges, ../types}+ {function.spawnPrivilegeStates, cid, privileges.groups.name, ../privileges, ../types}</tr>{{{ end }}}</tbody>@@ -104,7 +104,7 @@<!-- need this empty --></td><td class="text-center"><input autocomplete="off" type="checkbox" class="checkbox-helper"></td>- {function.spawnPrivilegeStates, privileges.users.username, ../privileges, ../types}+ {function.spawnPrivilegeStates, cid, privileges.users.username, ../privileges, ../types}</tr>{{{ end }}}</tbody>