fix(backend): フォローリクエストを作成する際に既存のものは削除するように (#13588)

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

(cherry picked from commit ea948ccadc7eace1fcace176c9c070b2a9b46f56)

* Update Changelog

* Update Changelog

---------

Co-authored-by: Kaity A <kaity@atikayda.au>
This commit is contained in:
かっこかり
2024-03-18 14:20:28 +09:00
committed by GitHub
parent b65203c9f8
commit a38646bd0f
2 changed files with 8 additions and 0 deletions

View File

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