[backend] Fix UserListJoining delete query on unfollow

This commit is contained in:
Laura Hausmann 2023-10-22 22:49:24 +02:00
parent c7dc059116
commit 10865168bf
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -45,7 +45,10 @@ export default async function (
return;
}
await UserListJoinings.delete({ userId: followee.id, userList: { userId: follower.id } });
const ids = await UserListJoinings.find({ where: { userId: followee.id, userList: { userId: follower.id } }, select: ["id"] })
.then(p => p.map(x => x.id));
if (ids.length > 0) await UserListJoinings.delete(ids);
await Followings.delete(following.id);
decrementFollowing(follower, followee);