monkeeShark/src/remote/activitypub/act/index.ts
Akihiko Odaki c22cb37759 Remove resolveRemoteUserObjects method of remote/activitypub/resolver
The value of the value returned by resolveRemoteUserObjects method of
remote/activitypub/resolver was inconsistent.
2018-04-03 20:41:54 +09:00

32 lines
854 B
TypeScript

import create from './create';
import follow from './follow';
import undo from './undo';
import createObject from '../create';
import Resolver from '../resolver';
export default async (parentResolver: Resolver, actor, value, distribute?: boolean) => {
const collection = await parentResolver.resolveCollection(value);
return collection.object.map(async element => {
const { resolver, object } = await collection.resolver.resolveOne(element);
const created = await (await createObject(resolver, actor, [object], distribute))[0];
if (created !== null) {
return created;
}
switch (object.type) {
case 'Create':
return create(resolver, actor, object, distribute);
case 'Follow':
return follow(resolver, actor, object, distribute);
case 'Undo':
return undo(resolver, actor, object);
default:
return null;
}
});
};