This commit is contained in:
syuilo
2018-06-01 00:42:37 +09:00
parent 51255bb446
commit 35115607bc
9 changed files with 110 additions and 3 deletions

View File

@ -416,7 +416,7 @@ export const pack = (
}
if (meId && !meId.equals(_user.id)) {
const [following1, following2, mute] = await Promise.all([
const [following1, following2, followReq1, followReq2, mute] = await Promise.all([
Following.findOne({
followerId: meId,
followeeId: _user.id
@ -425,6 +425,14 @@ export const pack = (
followerId: _user.id,
followeeId: meId
}),
_user.isLocked ? FollowRequest.findOne({
followerId: meId,
followeeId: _user.id
}) : Promise.resolve(null),
FollowRequest.findOne({
followerId: _user.id,
followeeId: meId
}),
Mute.findOne({
muterId: meId,
muteeId: _user.id
@ -435,6 +443,9 @@ export const pack = (
_user.isFollowing = following1 !== null;
_user.isStalking = following1 && following1.stalk;
_user.hasPendingFollowRequestFromYou = followReq1 !== null;
_user.hasPendingFollowRequestToYou = followReq2 !== null;
// Whether the user is followed
_user.isFollowed = following2 !== null;