mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
fixed #2657 -- there's a slight chance this might break other ACP pages, but my limited testing tells me it is ok so far
This commit is contained in:
@@ -458,6 +458,17 @@ define('settings', function () {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse all values. If they are json, return json
|
||||||
|
for(var key in values) {
|
||||||
|
if (values.hasOwnProperty(key)) {
|
||||||
|
try {
|
||||||
|
values[key] = JSON.parse(values[key]);
|
||||||
|
} catch (e) {
|
||||||
|
// Leave the value as is
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(formEl).deserialize(values);
|
$(formEl).deserialize(values);
|
||||||
|
|
||||||
callback(null, values);
|
callback(null, values);
|
||||||
@@ -474,6 +485,13 @@ define('settings', function () {
|
|||||||
values[inputEl.attr('id')] = 'off';
|
values[inputEl.attr('id')] = 'off';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Normalizing value of multiple selects
|
||||||
|
formEl.find('select[multiple]').each(function(idx, selectEl) {
|
||||||
|
selectEl = $(selectEl);
|
||||||
|
values[selectEl.attr('id')] = JSON.stringify(selectEl.val());
|
||||||
|
});
|
||||||
|
|
||||||
socket.emit('admin.settings.set', {
|
socket.emit('admin.settings.set', {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
values: values
|
values: values
|
||||||
|
|||||||
Reference in New Issue
Block a user