mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	Merge branch 'develop' into activitypub
This commit is contained in:
		| @@ -143,6 +143,29 @@ helpers.getUserDataByUserSlug = async function (userslug, callerUID, query = {}) | ||||
| 	return hookData.userData; | ||||
| }; | ||||
|  | ||||
| helpers.getCustomUserFields = async function (userData) { | ||||
| 	const keys = await db.getSortedSetRange('user-custom-fields', 0, -1); | ||||
| 	const allFields = (await db.getObjects(keys.map(k => `user-custom-field:${k}`))).filter(Boolean); | ||||
|  | ||||
| 	const fields = allFields.filter((field) => { | ||||
| 		const minRep = field['min:rep'] || 0; | ||||
| 		return userData.reputation >= minRep || meta.config['reputation:disabled']; | ||||
| 	}); | ||||
|  | ||||
| 	fields.forEach((f) => { | ||||
| 		f['select-options'] = f['select-options'].split('\n').filter(Boolean).map( | ||||
| 			opt => ({ | ||||
| 				value: opt, | ||||
| 				selected: opt === userData[f.key], | ||||
| 			}) | ||||
| 		); | ||||
| 		if (userData[f.key]) { | ||||
| 			f.value = validator.escape(String(userData[f.key])); | ||||
| 		} | ||||
| 	}); | ||||
| 	return fields; | ||||
| }; | ||||
|  | ||||
| function escape(value) { | ||||
| 	return translator.escape(validator.escape(String(value || ''))); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user