summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/renderer/follow-user.ts
blob: 9a488d392b4fb053d74b2ae60ee42baa902cc775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import config from '../../../config';
import * as mongo from 'mongodb';
import User, { isLocalUser } from '../../../models/user';

/**
 * Convert (local|remote)(Follower|Followee)ID to URL
 * @param id Follower|Followee ID
 */
export default async function renderFollowUser(id: mongo.ObjectID): Promise<any> {

	const user = await User.findOne({
		_id: id
	});

	return isLocalUser(user) ? `${config.url}/users/${user._id}` : user.uri;
}