refactor: resolve #7139

This commit is contained in:
syuilo 2021-02-13 15:33:38 +09:00
parent ebadd7fd3f
commit 91172654e4
76 changed files with 107 additions and 221 deletions

View file

@ -1,13 +1,12 @@
import config from '../../../config';
import { Users } from '../../../models';
import { User } from '../../../models/entities/user';
import { ensure } from '../../../prelude/ensure';
/**
* Convert (local|remote)(Follower|Followee)ID to URL
* @param id Follower|Followee ID
*/
export default async function renderFollowUser(id: User['id']): Promise<any> {
const user = await Users.findOne(id).then(ensure);
const user = await Users.findOneOrFail(id);
return Users.isLocalUser(user) ? `${config.url}/users/${user.id}` : user.uri;
}