From a796a68e8a64316378266681b3bb5cf718f6500b Mon Sep 17 00:00:00 2001
From: mei23 <m@m544.net>
Date: Sun, 8 Jul 2018 17:22:11 +0900
Subject: [PATCH 1/2] Fix can't process follow accept/reject from remote

---
 src/remote/activitypub/kernel/accept/follow.ts | 2 +-
 src/remote/activitypub/kernel/reject/follow.ts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/remote/activitypub/kernel/accept/follow.ts b/src/remote/activitypub/kernel/accept/follow.ts
index 0f414ba321..07c820c28a 100644
--- a/src/remote/activitypub/kernel/accept/follow.ts
+++ b/src/remote/activitypub/kernel/accept/follow.ts
@@ -5,7 +5,7 @@ import accept from '../../../../services/following/requests/accept';
 import { IFollow } from '../../type';
 
 export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
-	const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+	const id = typeof activity.actor == 'string' ? activity.actor : activity.actor.id;
 
 	if (!id.startsWith(config.url + '/')) {
 		return null;
diff --git a/src/remote/activitypub/kernel/reject/follow.ts b/src/remote/activitypub/kernel/reject/follow.ts
index c139865d0e..35cd2ec0c9 100644
--- a/src/remote/activitypub/kernel/reject/follow.ts
+++ b/src/remote/activitypub/kernel/reject/follow.ts
@@ -5,7 +5,7 @@ import reject from '../../../../services/following/requests/reject';
 import { IFollow } from '../../type';
 
 export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
-	const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+	const id = typeof activity.actor == 'string' ? activity.actor : activity.actor.id;
 
 	if (!id.startsWith(config.url + '/')) {
 		return null;

From 8ed9e44a78452396a9a3ee996eb3c24933a0accf Mon Sep 17 00:00:00 2001
From: mei23 <m@m544.net>
Date: Sun, 8 Jul 2018 17:22:18 +0900
Subject: [PATCH 2/2] Fix can't process cancel of follow request from remote

---
 src/remote/activitypub/kernel/undo/follow.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/remote/activitypub/kernel/undo/follow.ts b/src/remote/activitypub/kernel/undo/follow.ts
index 7377984616..f112ee8bfb 100644
--- a/src/remote/activitypub/kernel/undo/follow.ts
+++ b/src/remote/activitypub/kernel/undo/follow.ts
@@ -31,7 +31,7 @@ export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
 	});
 
 	if (req) {
-		await cancelRequest(actor, followee);
+		await cancelRequest(followee, actor);
 	} else {
 		await unfollow(actor, followee);
 	}