Add more federation support with Undo objects

This commit is contained in:
Jesse Wierzbinski 2023-11-23 08:55:33 -10:00
parent ae41139ad8
commit 1db82202e0
No known key found for this signature in database
3 changed files with 88 additions and 7 deletions

View file

@ -46,3 +46,30 @@ export const createLike = async (
// TODO: Add database jobs for federating this
}
};
export const deleteLike = async (
user: UserWithRelations,
status: StatusWithRelations
) => {
await client.like.deleteMany({
where: {
likedId: status.id,
likerId: user.id,
},
});
// Notify the user that their post has been favourited
await client.notification.deleteMany({
where: {
accountId: user.id,
type: "favourite",
notifiedId: status.authorId,
statusId: status.id,
},
});
if (user.instanceId === null) {
// User is local, federate the delete
// TODO: Federate this
}
};