refactor(api): deprecated groups update socket in favour of API lib

This commit is contained in:
Julian Lam
2020-12-21 22:05:00 -05:00
parent e640a41a78
commit 1cd2689cf6
8 changed files with 54 additions and 34 deletions

View File

@@ -24,6 +24,13 @@ module.exports = function (Groups) {
values: values,
}));
// Case some values as bool (if not boolean already)
['userTitleEnabled', 'private', 'hidden', 'disableJoinRequests', 'disableLeave'].forEach((prop) => {
if (values.hasOwnProperty(prop) && typeof values[prop] !== 'boolean') {
values[prop] = !!parseInt(values[prop], 10);
}
});
const payload = {
description: values.description || '',
icon: values.icon || '',