summaryrefslogtreecommitdiff
path: root/src/server/common/user/get-summary.ts
blob: b314a5cefbcc35977a5828eea9c91e5ca0e2644b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { ILocalAccount, IUser } from '../../api/models/user';
import getAcct from './get-acct';

/**
 * ユーザーを表す文字列を取得します。
 * @param user ユーザー
 */
export default function(user: IUser): string {
	let string = `${user.name} (@${getAcct(user)})\n` +
		`${user.postsCount}投稿、${user.followingCount}フォロー、${user.followersCount}フォロワー\n`;

	if (user.host === null) {
		const account = user.account as ILocalAccount;
		string += `場所: ${account.profile.location}、誕生日: ${account.profile.birthday}\n`;
	}

	return string + `「${user.description}」`;
}