Refactor
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import config from '../../../../conf';
|
||||
import { IRemoteAccount } from '../../../../models/user';
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
|
||||
export default ({ username }, { account }) => ({
|
||||
export default ({ username }, followee: IRemoteUser) => ({
|
||||
type: 'Follow',
|
||||
actor: `${config.url}/@${username}`,
|
||||
object: (account as IRemoteAccount).uri
|
||||
object: followee.account.uri
|
||||
});
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import config from '../../../../conf';
|
||||
import { extractPublic } from '../../../../crypto_key';
|
||||
import { ILocalAccount } from '../../../../models/user';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
export default ({ username, account }) => ({
|
||||
id: `${config.url}/@${username}/publickey`,
|
||||
export default (user: ILocalUser) => ({
|
||||
id: `${config.url}/@${user.username}/publickey`,
|
||||
type: 'Key',
|
||||
owner: `${config.url}/@${username}`,
|
||||
publicKeyPem: extractPublic((account as ILocalAccount).keypair)
|
||||
owner: `${config.url}/@${user.username}`,
|
||||
publicKeyPem: extractPublic(user.account.keypair)
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { ILocalAccount, IUser } from '../../models/user';
|
||||
import { IUser, isLocalUser } from '../../models/user';
|
||||
import getAcct from './get-acct';
|
||||
|
||||
/**
|
||||
@@ -9,8 +9,8 @@ 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;
|
||||
if (isLocalUser(user)) {
|
||||
const account = user.account;
|
||||
string += `場所: ${account.profile.location}、誕生日: ${account.profile.birthday}\n`;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user