mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #10993, apply autoLocale middleware to guests only
This commit is contained in:
@@ -86,15 +86,16 @@ module.exports = function (middleware) {
|
|||||||
}
|
}
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
if (parseInt(req.uid, 10) > 0 || !meta.config.autoDetectLang) {
|
|
||||||
return next();
|
if (meta.config.autoDetectLang && req.uid === 0) {
|
||||||
}
|
|
||||||
const langs = await listCodes();
|
const langs = await listCodes();
|
||||||
const lang = req.acceptsLanguages(langs);
|
const lang = req.acceptsLanguages(langs);
|
||||||
if (!lang) {
|
if (!lang) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
req.query.lang = lang;
|
req.query.lang = lang;
|
||||||
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user