This commit is contained in:
syuilo 2019-02-20 06:44:40 +09:00
parent 7921f8cd43
commit d51cafca74
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69

View file

@ -8,14 +8,14 @@ import { publishMainStream } from '../../stream';
import { insertFollowingDoc } from '../create'; import { insertFollowingDoc } from '../create';
export default async function(followee: IUser, follower: IUser) { export default async function(followee: IUser, follower: IUser) {
const request = await FollowRequest.findOne({
followeeId: followee._id,
followerId: follower._id
});
await insertFollowingDoc(followee, follower); await insertFollowingDoc(followee, follower);
if (isRemoteUser(follower)) { if (isRemoteUser(follower) && request) {
const request = await FollowRequest.findOne({
followeeId: followee._id,
followerId: follower._id
});
const content = renderActivity(renderAccept(renderFollow(follower, followee, request.requestId), followee as ILocalUser)); const content = renderActivity(renderAccept(renderFollow(follower, followee, request.requestId), followee as ILocalUser));
deliver(followee as ILocalUser, content, follower.inbox); deliver(followee as ILocalUser, content, follower.inbox);
} }