mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
Add more federation support with Undo objects
This commit is contained in:
parent
ae41139ad8
commit
1db82202e0
3 changed files with 88 additions and 7 deletions
|
|
@ -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
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue