This commit is contained in:
syuilo
2018-04-09 05:02:52 +09:00
parent 08beb45935
commit 536277122d
13 changed files with 7 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import Note from '../../../models/note';
import { IRemoteUser } from '../../../models/user';
import { ILike } from '../type';
import create from '../../../services/note/reaction/create';
export default async (actor: IRemoteUser, activity: ILike) => {
const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
// Transform:
// https://misskey.ex/notes/xxxx to
// xxxx
const noteId = id.split('/').pop();
const note = await Note.findOne({ _id: noteId });
if (note === null) {
throw new Error();
}
await create(actor, note, 'pudding');
};