mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #9149, incorrect client-side disableChatMessageEditing value for admins/gmods
This commit is contained in:
@@ -22,7 +22,7 @@ const socketioOrigins = nconf.get('socket.io:origins');
|
||||
const websocketAddress = nconf.get('socket.io:address') || '';
|
||||
|
||||
apiController.loadConfig = async function (req) {
|
||||
let config = {
|
||||
const config = {
|
||||
relative_path,
|
||||
upload_url,
|
||||
assetBaseUrl: `${relative_path}/assets`,
|
||||
@@ -83,8 +83,12 @@ apiController.loadConfig = async function (req) {
|
||||
};
|
||||
|
||||
let settings = config;
|
||||
let isAdminOrGlobalMod;
|
||||
if (req.loggedIn) {
|
||||
settings = await user.getSettings(req.uid);
|
||||
([settings, isAdminOrGlobalMod] = await Promise.all([
|
||||
user.getSettings(req.uid),
|
||||
user.isAdminOrGlobalMod(req.uid),
|
||||
]));
|
||||
}
|
||||
|
||||
// Handle old skin configs
|
||||
@@ -101,8 +105,11 @@ apiController.loadConfig = async function (req) {
|
||||
config.categoryTopicSort = settings.categoryTopicSort || config.categoryTopicSort;
|
||||
config.topicSearchEnabled = settings.topicSearchEnabled || false;
|
||||
config.bootswatchSkin = (meta.config.disableCustomUserSkins !== 1 && settings.bootswatchSkin && settings.bootswatchSkin !== '') ? settings.bootswatchSkin : '';
|
||||
config = await plugins.hooks.fire('filter:config.get', config);
|
||||
return config;
|
||||
|
||||
// Overrides based on privilege
|
||||
config.disableChatMessageEditing = isAdminOrGlobalMod ? false : config.disableChatMessageEditing;
|
||||
|
||||
return await plugins.hooks.fire('filter:config.get', config);
|
||||
};
|
||||
|
||||
apiController.getConfig = async function (req, res) {
|
||||
|
||||
Reference in New Issue
Block a user