Refactor
This commit is contained in:
parent
172f11a2a0
commit
9a6d524d5a
|
@ -1,6 +1,7 @@
|
||||||
import create from '../create';
|
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) {
|
if ('actor' in activity && actor.account.uri !== activity.actor) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,9 @@ import queue from '../../../queue';
|
||||||
import context from '../renderer/context';
|
import context from '../renderer/context';
|
||||||
import renderAccept from '../renderer/accept';
|
import renderAccept from '../renderer/accept';
|
||||||
import request from '../../request';
|
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 prefix = config.url + '/@';
|
||||||
const id = activity.object.id || activity.object;
|
const id = activity.object.id || activity.object;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,9 @@ import create from './create';
|
||||||
import follow from './follow';
|
import follow from './follow';
|
||||||
import undo from './undo';
|
import undo from './undo';
|
||||||
import createObject from '../create';
|
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 => {
|
return resolver.resolve(value).then(resolved => Promise.all(resolved.map(async promisedResult => {
|
||||||
const result = await promisedResult;
|
const result = await promisedResult;
|
||||||
const created = await (await createObject(result.resolver, actor, [result.object], distribute))[0];
|
const created = await (await createObject(result.resolver, actor, [result.object], distribute))[0];
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import act from '../../act';
|
import act from '../../act';
|
||||||
import unfollow from './unfollow';
|
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) {
|
if ('actor' in activity && actor.account.uri !== activity.actor) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue