summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/kernel/undo/like.ts
blob: bd6930c66b6d6799a98a32a17596e24caf2018e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
	return `ok`;
};