24 lines
496 B
TypeScript
24 lines
496 B
TypeScript
import act from '../../act';
|
|
import unfollow from './unfollow';
|
|
|
|
export default async (resolver, actor, activity) => {
|
|
if ('actor' in activity && actor.account.uri !== activity.actor) {
|
|
throw new Error();
|
|
}
|
|
|
|
const results = await act(resolver, actor, activity.object);
|
|
|
|
await Promise.all(results.map(async result => {
|
|
if (result === null) {
|
|
return;
|
|
}
|
|
|
|
switch (result.object.$ref) {
|
|
case 'following':
|
|
await unfollow(result.resolver, result.object);
|
|
}
|
|
}));
|
|
|
|
return null;
|
|
};
|