summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAcid Chicken (硫酸鶏) <root@acid-chicken.com>2018-12-06 00:37:59 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-12-06 00:37:59 +0900
commitfe891da8865f9ba87b4a8d44fa91e299ac79f3e3 (patch)
tree477d6dd6c60db433737b402a9f475438eb579123 /src
parentAdd small syntax (#3506) (diff)
downloadsharkey-fe891da8865f9ba87b4a8d44fa91e299ac79f3e3.tar.gz
sharkey-fe891da8865f9ba87b4a8d44fa91e299ac79f3e3.tar.bz2
sharkey-fe891da8865f9ba87b4a8d44fa91e299ac79f3e3.zip
外部サービス連携情報を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
Diffstat (limited to 'src')
-rw-r--r--src/remote/activitypub/renderer/person.ts25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts
index 52485e6959..f02710aad0 100644
--- a/src/remote/activitypub/renderer/person.ts
+++ b/src/remote/activitypub/renderer/person.ts
@@ -13,6 +13,28 @@ export default async (user: ILocalUser) => {
DriveFile.findOne({ _id: user.avatarId }),
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 {
type: user.isBot ? 'Service' : 'Person',
@@ -31,6 +53,7 @@ export default async (user: ILocalUser) => {
image: user.bannerId && renderImage(banner),
manuallyApprovesFollowers: user.isLocked,
publicKey: renderKey(user),
- isCat: user.isCat
+ isCat: user.isCat,
+ attachment: attachment.length ? attachment : undefined
};
};