FoundKey/src/remote/activitypub/kernel/undo/like.ts
syuilo 98c26dfff8 fix(activitypub): not reacted な Undo.Like がinboxに滞留するのを修正
https: //github.com/mei23/misskey/commit/1cfb5e09a44819b82333df26409ec9d9657bdcfc
Co-Authored-By: MeiMei <30769358+mei23@users.noreply.github.com>
2021-10-21 00:28:27 +09:00

22 lines
608 B
TypeScript

import { IRemoteUser } from '@/models/entities/user';
import { ILike, getApId } from '../../type';
import deleteReaction from '@/services/note/reaction/delete';
import { fetchNote } from '../../models/note';
/**
* Process Undo.Like activity
*/
export default async (actor: IRemoteUser, activity: ILike) => {
const targetUri = getApId(activity.object);
const note = await fetchNote(targetUri);
if (!note) return `skip: target note not found ${targetUri}`;
await deleteReaction(actor, note).catch(e => {
if (e.id === '60527ec9-b4cb-4a88-a6bd-32d3ad26817d') return;
throw e;
});
return `ok`;
};