mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: translate custom field names and values when federating out
This commit is contained in:
@@ -197,7 +197,7 @@ Mocks.actors = {};
|
|||||||
Mocks.actors.user = async (uid) => {
|
Mocks.actors.user = async (uid) => {
|
||||||
const userData = await user.getUserData(uid);
|
const userData = await user.getUserData(uid);
|
||||||
let { username, userslug, displayname, fullname, joindate, aboutme, picture, 'cover:url': cover } = userData;
|
let { username, userslug, displayname, fullname, joindate, aboutme, picture, 'cover:url': cover } = userData;
|
||||||
const fields = await accountHelpers.getCustomUserFields(userData);
|
let fields = await accountHelpers.getCustomUserFields(userData);
|
||||||
const publicKey = await activitypub.getPublicKey('uid', uid);
|
const publicKey = await activitypub.getPublicKey('uid', uid);
|
||||||
|
|
||||||
let aboutmeParsed = '';
|
let aboutmeParsed = '';
|
||||||
@@ -226,6 +226,15 @@ Mocks.actors.user = async (uid) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const attachment = [];
|
const attachment = [];
|
||||||
|
// Translate field names and values
|
||||||
|
fields = await Promise.all(fields.map(async (field) => {
|
||||||
|
const [name, value] = await Promise.all([
|
||||||
|
translator.translate(field.name),
|
||||||
|
translator.translate(field.value),
|
||||||
|
]);
|
||||||
|
field = { ...field, ...{ name, value } };
|
||||||
|
return field;
|
||||||
|
}));
|
||||||
fields.forEach(({ type, name, value }) => {
|
fields.forEach(({ type, name, value }) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
if (type === 'input-link') {
|
if (type === 'input-link') {
|
||||||
|
|||||||
Reference in New Issue
Block a user