Node.js based forum software built for the modern web
refactor: change name to privileges to match other apis
Barış Soner Uşaklı2100a03c1a9d
diff --git a/public/openapi/read.yaml b/public/openapi/read.yamlindex 8a60e0342f..2899178a16 100644--- a/public/openapi/read.yaml+++ b/public/openapi/read.yaml@@ -4542,12 +4542,12 @@ paths:type: stringsearchDefaultSortBy:type: string- permissions:+ privileges:type: objectproperties:- users:+ search:users:type: boolean- content:+ search:content:type: booleanrequired:- postsdiff --git a/src/controllers/search.js b/src/controllers/search.jsindex 9f6aa10c68..ed0e78c0a3 100644--- a/src/controllers/search.js+++ b/src/controllers/search.js@@ -22,12 +22,12 @@ searchController.search = async function (req, res, next) {const searchOnly = parseInt(req.query.searchOnly, 10) === 1;- const permissions = await utils.promiseParallel({- users: privileges.global.can('search:users', req.uid),- content: privileges.global.can('search:content', req.uid),+ const userPrivileges = await utils.promiseParallel({+ 'search:users': privileges.global.can('search:users', req.uid),+ 'search:content': privileges.global.can('search:content', req.uid),});- const allowed = (req.query.in === 'users') ? permissions.users : permissions.content;+ const allowed = (req.query.in === 'users') ? userPrivileges['search:users'] : userPrivileges['search:content'];if (!allowed) {return helpers.notAllowed(req, res);@@ -84,7 +84,7 @@ searchController.search = async function (req, res, next) {searchData.title = '[[global:header.search]]';searchData.searchDefaultSortBy = meta.config.searchDefaultSortBy || '';- searchData.permissions = permissions;+ searchData.privileges = userPrivileges;res.render('search', searchData);};