Skip to content

Commit

Permalink
fix: delete old follow request (if exists) before creating new
Browse files Browse the repository at this point in the history
  • Loading branch information
supakaity committed Feb 24, 2024
1 parent 7b7de4c commit ea948cc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/backend/src/core/UserFollowingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ea948cc

Please sign in to comment.