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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -18,6 +18,8 @@
### Server ### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
- Fix: フォローリクエストを作成する際に既存のものは削除するように
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440)
## 2024.3.1 ## 2024.3.1

View file

@ -511,6 +511,12 @@ export class UserFollowingService implements OnModuleInit {
if (blocking) throw new Error('blocking'); if (blocking) throw new Error('blocking');
if (blocked) throw new Error('blocked'); 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({ const followRequest = await this.followRequestsRepository.insert({
id: this.idService.gen(), id: this.idService.gen(),
followerId: follower.id, followerId: follower.id,