forked from FoundKeyGang/FoundKey
Johann150
36a0e48e49
There are still many places where import paths with `..` are used and maybe should use absolute paths also.
22 lines
666 B
TypeScript
22 lines
666 B
TypeScript
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
|
import deleteReaction from '@/services/note/reaction/delete.js';
|
|
import { ILike, getApId } from '@/remote/activitypub/type.js';
|
|
import { fetchNote } from '@/remote/activitypub/models/note.js';
|
|
|
|
/**
|
|
* Process Undo.Like activity
|
|
*/
|
|
export default async (actor: CacheableRemoteUser, 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';
|
|
};
|