1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-25 20:18:28 +09:00
misskey/src/remote/activitypub/act/index.ts

23 lines
590 B
TypeScript
Raw Normal View History

2018-03-31 19:55:00 +09:00
import create from './create';
import createObject from '../create';
import Resolver from '../resolver';
2018-04-02 17:11:14 +09:00
export default (actor, value, distribute) => {
2018-04-01 21:19:39 +09:00
return new Resolver().resolve(value).then(resolved => Promise.all(resolved.map(async promisedResult => {
const { resolver, object } = await promisedResult;
2018-04-02 17:11:14 +09:00
const created = await (await createObject(resolver, actor, [object], distribute))[0];
2018-03-31 19:55:00 +09:00
if (created !== null) {
return created;
}
switch (object.type) {
case 'Create':
2018-04-02 17:11:14 +09:00
return create(resolver, actor, object, distribute);
2018-03-31 19:55:00 +09:00
default:
return null;
}
})));
2018-04-01 21:17:46 +09:00
};