mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-25 09:43:08 +02:00
a1b490afa7
Closes #1411
20 lines
581 B
TypeScript
20 lines
581 B
TypeScript
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/@syuilo/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');
|
|
};
|