mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-01 07:35:57 +09:00
外部サービス連携情報をPersonのfieldsに乗せて配信する (#3499)
* Update person.ts * Update person.ts refs: https://github.com/syuilo/misskey/pull/3499#issuecomment-444484557 * Update person.ts refs: https://github.com/syuilo/misskey/pull/3499#pullrequestreview-181755475
This commit is contained in:
parent
66836836ab
commit
fe891da886
@ -14,6 +14,28 @@ export default async (user: ILocalUser) => {
|
|||||||
DriveFile.findOne({ _id: user.bannerId })
|
DriveFile.findOne({ _id: user.bannerId })
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const attachment: {
|
||||||
|
type: string,
|
||||||
|
name: string,
|
||||||
|
value: string,
|
||||||
|
verified_at?: string
|
||||||
|
}[] = [];
|
||||||
|
user.twitter && attachment.push({
|
||||||
|
type: 'PropertyValue',
|
||||||
|
name: 'Twitter',
|
||||||
|
value: `<a href="https://twitter.com/intent/user?user_id=${user.twitter.userId}" rel="me nofollow noopener" target="_blank"><span>@${user.twitter.screenName}</span></a>`
|
||||||
|
});
|
||||||
|
user.github && attachment.push({
|
||||||
|
type: 'PropertyValue',
|
||||||
|
name: 'GitHub',
|
||||||
|
value: `<a href="https://github.com/${user.github.login}" rel="me nofollow noopener" target="_blank"><span>@${user.github.login}</span></a>`
|
||||||
|
});
|
||||||
|
user.discord && attachment.push({
|
||||||
|
type: 'PropertyValue',
|
||||||
|
name: 'Discord',
|
||||||
|
value: `<a href="https://discordapp.com/users/${user.discord.id}" rel="me nofollow noopener" target="_blank"><span>@${user.discord.username}#${user.discord.discriminator}</span></a>`
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: user.isBot ? 'Service' : 'Person',
|
type: user.isBot ? 'Service' : 'Person',
|
||||||
id,
|
id,
|
||||||
@ -31,6 +53,7 @@ export default async (user: ILocalUser) => {
|
|||||||
image: user.bannerId && renderImage(banner),
|
image: user.bannerId && renderImage(banner),
|
||||||
manuallyApprovesFollowers: user.isLocked,
|
manuallyApprovesFollowers: user.isLocked,
|
||||||
publicKey: renderKey(user),
|
publicKey: renderKey(user),
|
||||||
isCat: user.isCat
|
isCat: user.isCat,
|
||||||
|
attachment: attachment.length ? attachment : undefined
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user