From c051779d341b2b3e466a58f57844a20e9beb5661 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 27 Mar 2018 11:47:13 +0900 Subject: [PATCH] Refactor --- src/api/models/user.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 545747b50..3f0b10d4c 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -293,17 +293,19 @@ export const packForAp = ( if (!_user) return reject('invalid user arg.'); + const userUrl = `${config.url}/${_user.username}`; + resolve({ "@context": ["https://www.w3.org/ns/activitystreams", { "@language": "ja" }], "type": "Person", - "id": `${config.url}/${_user.username}`, - "following": `${config.url}/${_user.username}/following.json`, - "followers": `${config.url}/${_user.username}/followers.json`, - "liked": `${config.url}/${_user.username}/liked.json`, - "inbox": `${config.url}/${_user.username}/inbox.json`, - "outbox": `${config.url}/${_user.username}/feed.json`, + "id": userUrl, + "following": `${userUrl}/following.json`, + "followers": `${userUrl}/followers.json`, + "liked": `${userUrl}/liked.json`, + "inbox": `${userUrl}/inbox.json`, + "outbox": `${userUrl}/outbox.json`, "preferredUsername": _user.username, "name": _user.name, "summary": _user.description,