mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-26 22:29:28 +09:00
Fix bug: Check following request existance
This commit is contained in:
parent
37865cb381
commit
e31a2f7e55
@ -27,7 +27,11 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
|||||||
return rej('followee not found');
|
return rej('followee not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
await cancelFollowRequest(followee, user);
|
await cancelFollowRequest(followee, user);
|
||||||
|
} catch (e) {
|
||||||
|
return rej(e);
|
||||||
|
}
|
||||||
|
|
||||||
// Send response
|
// Send response
|
||||||
res(await pack(followee._id, user));
|
res(await pack(followee._id, user));
|
||||||
|
@ -12,6 +12,15 @@ export default async function(followee: IUser, follower: IUser) {
|
|||||||
deliver(follower as ILocalUser, content, followee.inbox);
|
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({
|
await FollowRequest.remove({
|
||||||
followeeId: followee._id,
|
followeeId: followee._id,
|
||||||
followerId: follower._id
|
followerId: follower._id
|
||||||
|
Loading…
Reference in New Issue
Block a user