From 7dc06b3d4383321ef85fa9bf2a1bc1d16ecab8c2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 7 Apr 2018 15:54:11 +0900 Subject: Refactor --- src/remote/activitypub/act/undo/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/remote/activitypub/act/undo/index.ts (limited to 'src/remote/activitypub/act/undo/index.ts') diff --git a/src/remote/activitypub/act/undo/index.ts b/src/remote/activitypub/act/undo/index.ts new file mode 100644 index 0000000000..ecd9944b42 --- /dev/null +++ b/src/remote/activitypub/act/undo/index.ts @@ -0,0 +1,15 @@ +import unfollow from './follow'; + +export default async (actor, activity): Promise => { + if ('actor' in activity && actor.account.uri !== activity.actor) { + throw new Error('invalid actor'); + } + + switch (activity.object.type) { + case 'Follow': + unfollow(actor, activity.object); + break; + } + + return null; +}; -- cgit v1.3.1-freya