mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-23 02:17:40 -07:00
Fix bug
This commit is contained in:
parent
aa30e2faeb
commit
cfd19c23a1
2 changed files with 9 additions and 7 deletions
|
@ -46,11 +46,19 @@ export async function insertFollowingDoc(followee: IUser, follower: IUser) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await FollowRequest.remove({
|
const removed = await FollowRequest.remove({
|
||||||
followeeId: followee._id,
|
followeeId: followee._id,
|
||||||
followerId: follower._id
|
followerId: follower._id
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (removed.deletedCount === 1) {
|
||||||
|
await User.update({ _id: followee._id }, {
|
||||||
|
$inc: {
|
||||||
|
pendingReceivedFollowRequestsCount: -1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (alreadyFollowed) return;
|
if (alreadyFollowed) return;
|
||||||
|
|
||||||
//#region Increment counts
|
//#region Increment counts
|
||||||
|
|
|
@ -20,12 +20,6 @@ export default async function(followee: IUser, follower: IUser) {
|
||||||
deliver(followee as ILocalUser, content, follower.inbox);
|
deliver(followee as ILocalUser, content, follower.inbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
await User.update({ _id: followee._id }, {
|
|
||||||
$inc: {
|
|
||||||
pendingReceivedFollowRequestsCount: -1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
packUser(followee, followee, {
|
packUser(followee, followee, {
|
||||||
detail: true
|
detail: true
|
||||||
}).then(packed => publishMainStream(followee._id, 'meUpdated', packed));
|
}).then(packed => publishMainStream(followee._id, 'meUpdated', packed));
|
||||||
|
|
Loading…
Reference in a new issue