fix: delete old follow request (if exists) before creating new

This commit is contained in:
Kaity A 2024-02-24 04:38:01 +00:00
parent 7b7de4cdb3
commit ea948ccadc
No known key found for this signature in database
GPG key ID: E18FEFAE47FF0ACB

View file

@ -479,6 +479,12 @@ export class UserFollowingService implements OnModuleInit {
if (blocking) throw new Error('blocking');
if (blocked) throw new Error('blocked');
// Remove old follow requests before creating a new one.
await this.followRequestsRepository.delete({
followeeId: followee.id,
followerId: follower.id,
});
const followRequest = await this.followRequestsRepository.insert({
id: this.idService.gen(),
followerId: follower.id,