1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-26 04:28:28 +09:00
misskey/src/remote/activitypub/act/index.ts
2018-04-07 17:05:14 +09:00

47 lines
879 B
TypeScript

import { Object } from '../type';
import { IRemoteUser } from '../../../models/user';
import create from './create';
import performDeleteActivity from './delete';
import follow from './follow';
import undo from './undo';
import like from './like';
const self = async (actor: IRemoteUser, activity: Object): Promise<void> => {
switch (activity.type) {
case 'Create':
await create(actor, activity);
break;
case 'Delete':
await performDeleteActivity(actor, activity);
break;
case 'Follow':
await follow(actor, activity);
break;
case 'Accept':
// noop
break;
case 'Like':
await like(actor, activity);
break;
case 'Undo':
await undo(actor, activity);
break;
case 'Collection':
case 'OrderedCollection':
// TODO
break;
default:
console.warn(`unknown activity type: ${(activity as any).type}`);
return null;
}
};
export default self;