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

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440

Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Marie <marie@kaifa.ch>
This commit is contained in:
Marie 2024-02-24 18:16:16 +00:00
commit 1b65c06d60
1 changed files with 6 additions and 0 deletions

View File

@ -520,6 +520,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,