summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/renderer/follow.ts
blob: 98d4cdd020aac11062ca4bed78bed1e6f3e52b04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import config from '../../../config';
import { IUser, isLocalUser } from '../../../models/user';

export default (follower: IUser, followee: IUser, requestId?: string) => {
	const follow = {
		type: 'Follow',
		actor: isLocalUser(follower) ? `${config.url}/users/${follower._id}` : follower.uri,
		object: isLocalUser(followee) ? `${config.url}/users/${followee._id}` : followee.uri
	} as any;

	if (requestId) follow.id = requestId;

	return follow;
};