Skip to content

Commit

Permalink
fix(backend): フォローリクエストを作成する際に既存のものは削除するように (#13588)
Browse files Browse the repository at this point in the history
* fix: delete old follow request (if exists) before creating new

(cherry picked from commit ea948cc)

* Update Changelog

* Update Changelog

---------

Co-authored-by: Kaity A <[email protected]>
  • Loading branch information
kakkokari-gtyih and supakaity authored Mar 18, 2024
1 parent b65203c commit a38646b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

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

## 2024.3.1

Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/core/UserFollowingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a38646b

Please sign in to comment.