mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #9185, fix string boolean values
This commit is contained in:
@@ -24,10 +24,11 @@ module.exports = function (Groups) {
|
||||
values: values,
|
||||
}));
|
||||
|
||||
// Case some values as bool (if not boolean already)
|
||||
// Cast some values as bool (if not boolean already)
|
||||
// 'true' and '1' = true, everything else false
|
||||
['userTitleEnabled', 'private', 'hidden', 'disableJoinRequests', 'disableLeave'].forEach((prop) => {
|
||||
if (values.hasOwnProperty(prop) && typeof values[prop] !== 'boolean') {
|
||||
values[prop] = !!parseInt(values[prop], 10);
|
||||
values[prop] = values[prop] === 'true' || parseInt(values[prop], 10) === 1;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user