From 9a6d524d5a8b1cf481414238fdaf7764607611ae Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 3 Apr 2018 20:09:26 +0900 Subject: [PATCH] Refactor --- src/remote/activitypub/act/create.ts | 3 ++- src/remote/activitypub/act/follow.ts | 3 ++- src/remote/activitypub/act/index.ts | 3 ++- src/remote/activitypub/act/undo/index.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/remote/activitypub/act/create.ts b/src/remote/activitypub/act/create.ts index a6ba9a1d2..fa681982c 100644 --- a/src/remote/activitypub/act/create.ts +++ b/src/remote/activitypub/act/create.ts @@ -1,6 +1,7 @@ import create from '../create'; +import Resolver from '../resolver'; -export default (resolver, actor, activity, distribute) => { +export default (resolver: Resolver, actor, activity, distribute) => { if ('actor' in activity && actor.account.uri !== activity.actor) { throw new Error(); } diff --git a/src/remote/activitypub/act/follow.ts b/src/remote/activitypub/act/follow.ts index 385fc58ef..23fa41df8 100644 --- a/src/remote/activitypub/act/follow.ts +++ b/src/remote/activitypub/act/follow.ts @@ -7,8 +7,9 @@ import queue from '../../../queue'; import context from '../renderer/context'; import renderAccept from '../renderer/accept'; import request from '../../request'; +import Resolver from '../resolver'; -export default async (resolver, actor, activity, distribute) => { +export default async (resolver: Resolver, actor, activity, distribute) => { const prefix = config.url + '/@'; const id = activity.object.id || activity.object; diff --git a/src/remote/activitypub/act/index.ts b/src/remote/activitypub/act/index.ts index 3b7dd5b24..2af190221 100644 --- a/src/remote/activitypub/act/index.ts +++ b/src/remote/activitypub/act/index.ts @@ -2,8 +2,9 @@ import create from './create'; import follow from './follow'; import undo from './undo'; import createObject from '../create'; +import Resolver from '../resolver'; -export default (resolver, actor, value, distribute?: boolean) => { +export default (resolver: Resolver, actor, value, distribute?: boolean) => { return resolver.resolve(value).then(resolved => Promise.all(resolved.map(async promisedResult => { const result = await promisedResult; const created = await (await createObject(result.resolver, actor, [result.object], distribute))[0]; diff --git a/src/remote/activitypub/act/undo/index.ts b/src/remote/activitypub/act/undo/index.ts index c34d56e70..d104eeb80 100644 --- a/src/remote/activitypub/act/undo/index.ts +++ b/src/remote/activitypub/act/undo/index.ts @@ -1,7 +1,8 @@ import act from '../../act'; import unfollow from './unfollow'; +import Resolver from '../../resolver'; -export default async (resolver, actor, activity) => { +export default async (resolver: Resolver, actor, activity) => { if ('actor' in activity && actor.account.uri !== activity.actor) { throw new Error(); }