Allow to undo Create activity

This commit is contained in:
Akihiko Odaki 2018-04-04 19:51:41 +09:00
parent 210cb57aa5
commit 783453897f
5 changed files with 30 additions and 17 deletions

View file

@ -1,24 +0,0 @@
import create from '../../create';
import deletePost from './post';
export default async (resolver, actor, activity) => {
if ('actor' in activity && actor.account.uri !== activity.actor) {
throw new Error();
}
const results = await create(resolver, actor, activity.object);
await Promise.all(results.map(async promisedResult => {
const result = await promisedResult;
if (result === null) {
return;
}
switch (result.object.$ref) {
case 'posts':
await deletePost(result.object);
}
}));
return null;
};