c22cb37759
The value of the value returned by resolveRemoteUserObjects method of remote/activitypub/resolver was inconsistent.
33 lines
854 B
TypeScript
33 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;
|
|
}
|
|
});
|
|
};
|