Allow to undo Create activity
This commit is contained in:
parent
210cb57aa5
commit
783453897f
5 changed files with 30 additions and 17 deletions
21
src/remote/activitypub/act/delete.ts
Normal file
21
src/remote/activitypub/act/delete.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import create from '../create';
|
||||
import deleteObject from '../delete';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
await deleteObject(result);
|
||||
}));
|
||||
|
||||
return null;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue