mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
await promises (#8519)
This commit is contained in:
parent
cd7b04e90d
commit
b68ac308ec
@ -95,17 +95,12 @@ async function unFollow(follower: User, followee: User) {
|
||||
return;
|
||||
}
|
||||
|
||||
Followings.delete(following.id);
|
||||
|
||||
//#region Decrement following count
|
||||
Users.decrement({ id: follower.id }, 'followingCount', 1);
|
||||
//#endregion
|
||||
|
||||
//#region Decrement followers count
|
||||
Users.decrement({ id: followee.id }, 'followersCount', 1);
|
||||
//#endregion
|
||||
|
||||
perUserFollowingChart.update(follower, followee, false);
|
||||
await Promises.all([
|
||||
Followings.delete(following.id),
|
||||
Users.decrement({ id: follower.id }, 'followingCount', 1),
|
||||
Users.decrement({ id: followee.id }, 'followersCount', 1),
|
||||
perUserFollowingChart.update(follower, followee, false),
|
||||
]);
|
||||
|
||||
// Publish unfollow event
|
||||
if (Users.isLocalUser(follower)) {
|
||||
|
@ -67,8 +67,10 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[
|
||||
if (alreadyFollowed) return;
|
||||
|
||||
//#region Increment counts
|
||||
Users.increment({ id: follower.id }, 'followingCount', 1);
|
||||
Users.increment({ id: followee.id }, 'followersCount', 1);
|
||||
await Promises.all([
|
||||
Users.increment({ id: follower.id }, 'followingCount', 1),
|
||||
Users.increment({ id: followee.id }, 'followersCount', 1),
|
||||
]);
|
||||
//#endregion
|
||||
|
||||
//#region Update instance stats
|
||||
|
@ -58,12 +58,11 @@ export default async function(follower: { id: User['id']; host: User['host']; ur
|
||||
}
|
||||
|
||||
export async function decrementFollowing(follower: { id: User['id']; host: User['host']; }, followee: { id: User['id']; host: User['host']; }) {
|
||||
//#region Decrement following count
|
||||
Users.decrement({ id: follower.id }, 'followingCount', 1);
|
||||
//#endregion
|
||||
|
||||
//#region Decrement followers count
|
||||
Users.decrement({ id: followee.id }, 'followersCount', 1);
|
||||
//#region Decrement following / followers counts
|
||||
await Promises.all([
|
||||
Users.decrement({ id: follower.id }, 'followingCount', 1),
|
||||
Users.decrement({ id: followee.id }, 'followersCount', 1),
|
||||
]);
|
||||
//#endregion
|
||||
|
||||
//#region Update instance stats
|
||||
|
Loading…
Reference in New Issue
Block a user