diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-08-23 14:56:39 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-08-23 14:56:39 +0900 |
| commit | e31a2f7e55bb96d661945d0475cc5cc678c0eb18 (patch) | |
| tree | ab1a5a43efb43ea9811f4513d6a7945c27d38186 /src/services | |
| parent | Merge pull request #2416 from syuilo/master (diff) | |
| download | sharkey-e31a2f7e55bb96d661945d0475cc5cc678c0eb18.tar.gz sharkey-e31a2f7e55bb96d661945d0475cc5cc678c0eb18.tar.bz2 sharkey-e31a2f7e55bb96d661945d0475cc5cc678c0eb18.zip | |
Fix bug: Check following request existance
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/following/requests/cancel.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/services/following/requests/cancel.ts b/src/services/following/requests/cancel.ts index b0b574da58..26e4544d5c 100644 --- a/src/services/following/requests/cancel.ts +++ b/src/services/following/requests/cancel.ts @@ -12,6 +12,15 @@ export default async function(followee: IUser, follower: IUser) { deliver(follower as ILocalUser, content, followee.inbox); } + const request = await FollowRequest.findOne({ + followeeId: followee._id, + followerId: follower._id + }); + + if (request == null) { + throw 'request not found'; + } + await FollowRequest.remove({ followeeId: followee._id, followerId: follower._id |