From fe891da8865f9ba87b4a8d44fa91e299ac79f3e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?=
 <root@acid-chicken.com>
Date: Thu, 6 Dec 2018 00:37:59 +0900
Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E9=83=A8=E3=82=B5=E3=83=BC=E3=83=93?=
 =?UTF-8?q?=E3=82=B9=E9=80=A3=E6=90=BA=E6=83=85=E5=A0=B1=E3=82=92Person?=
 =?UTF-8?q?=E3=81=AEfields=E3=81=AB=E4=B9=97=E3=81=9B=E3=81=A6=E9=85=8D?=
 =?UTF-8?q?=E4=BF=A1=E3=81=99=E3=82=8B=20(#3499)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* 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
---
 src/remote/activitypub/renderer/person.ts | 25 ++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

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
 	};
 };