mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: do not include image or icon props if they are falsy values
This commit is contained in:
@@ -486,35 +486,37 @@ Mocks.actors.user = async (uid) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'@context': [
|
...{
|
||||||
'https://www.w3.org/ns/activitystreams',
|
'@context': [
|
||||||
'https://w3id.org/security/v1',
|
'https://www.w3.org/ns/activitystreams',
|
||||||
],
|
'https://w3id.org/security/v1',
|
||||||
id: `${nconf.get('url')}/uid/${uid}`,
|
],
|
||||||
url: `${nconf.get('url')}/user/${userslug}`,
|
id: `${nconf.get('url')}/uid/${uid}`,
|
||||||
followers: `${nconf.get('url')}/uid/${uid}/followers`,
|
url: `${nconf.get('url')}/user/${userslug}`,
|
||||||
following: `${nconf.get('url')}/uid/${uid}/following`,
|
followers: `${nconf.get('url')}/uid/${uid}/followers`,
|
||||||
inbox: `${nconf.get('url')}/uid/${uid}/inbox`,
|
following: `${nconf.get('url')}/uid/${uid}/following`,
|
||||||
outbox: `${nconf.get('url')}/uid/${uid}/outbox`,
|
inbox: `${nconf.get('url')}/uid/${uid}/inbox`,
|
||||||
|
outbox: `${nconf.get('url')}/uid/${uid}/outbox`,
|
||||||
|
|
||||||
type: 'Person',
|
type: 'Person',
|
||||||
name: username !== displayname ? fullname : username, // displayname is escaped, fullname is not
|
name: username !== displayname ? fullname : username, // displayname is escaped, fullname is not
|
||||||
preferredUsername: userslug,
|
preferredUsername: userslug,
|
||||||
summary: aboutmeParsed,
|
summary: aboutmeParsed,
|
||||||
icon: picture,
|
published: new Date(joindate).toISOString(),
|
||||||
image: cover,
|
attachment,
|
||||||
published: new Date(joindate).toISOString(),
|
|
||||||
attachment,
|
|
||||||
|
|
||||||
publicKey: {
|
publicKey: {
|
||||||
id: `${nconf.get('url')}/uid/${uid}#key`,
|
id: `${nconf.get('url')}/uid/${uid}#key`,
|
||||||
owner: `${nconf.get('url')}/uid/${uid}`,
|
owner: `${nconf.get('url')}/uid/${uid}`,
|
||||||
publicKeyPem: publicKey,
|
publicKeyPem: publicKey,
|
||||||
},
|
},
|
||||||
|
|
||||||
endpoints: {
|
endpoints: {
|
||||||
sharedInbox: `${nconf.get('url')}/inbox`,
|
sharedInbox: `${nconf.get('url')}/inbox`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
...(picture && { icon: picture }),
|
||||||
|
...(cover && { image: cover }),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user