mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
@@ -194,7 +194,11 @@ helpers.getCustomUserFields = async function (callerUID, userData) {
|
||||
if (f.type === 'input-link' && userValue) {
|
||||
f.linkValue = validator.escape(String(userValue.replace('http://', '').replace('https://', '')));
|
||||
}
|
||||
f['select-options'] = (f['select-options'] || '').split('\n').filter(Boolean).map(
|
||||
f['select-options'] = (f['select-options'] || '').split('\n').filter(Boolean);
|
||||
if (f.type === 'select') {
|
||||
f['select-options'].unshift('');
|
||||
}
|
||||
f['select-options'] = f['select-options'].map(
|
||||
opt => ({
|
||||
value: opt,
|
||||
selected: Array.isArray(userValue) ?
|
||||
|
||||
@@ -127,7 +127,7 @@ module.exports = function (User) {
|
||||
));
|
||||
} else if (field.type === 'select') {
|
||||
const opts = field['select-options'].split('\n').filter(Boolean);
|
||||
if (!opts.includes(value)) {
|
||||
if (!opts.includes(value) && value !== '') {
|
||||
throw new Error(tx.compile(
|
||||
'error:custom-user-field-select-value-invalid', field.name
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user