[backend] Remove user from list on unfollow

This commit is contained in:
Laura Hausmann 2023-10-19 00:57:09 +02:00
parent 11b3d4fa0a
commit d1cf1b5611
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605

View File

@ -7,7 +7,7 @@ import { deliver, webhookDeliver } from "@/queue/index.js";
import Logger from "../logger.js";
import { registerOrFetchInstanceDoc } from "../register-or-fetch-instance-doc.js";
import type { User } from "@/models/entities/user.js";
import { Followings, Users, Instances } from "@/models/index.js";
import { Followings, Users, Instances, UserListJoinings } from "@/models/index.js";
import {
instanceChart,
perUserFollowingChart,
@ -45,6 +45,7 @@ export default async function (
return;
}
await UserListJoinings.delete({ userId: followee.id, userList: { userId: follower.id } });
await Followings.delete(following.id);
decrementFollowing(follower, followee);