mirror of
https://github.com/spacebarchat/server.git
synced 2026-04-14 00:45:40 +00:00
Merge pull request #1463 from CyberL1/fix/mutual-friends
This commit is contained in:
@@ -100,7 +100,7 @@ router.get("/", route({ responses: { 200: { body: "UserProfileResponse" } } }),
|
||||
let mutual_friends_count = 0;
|
||||
|
||||
if (with_mutual_friends == "true" || with_mutual_friends_count == "true") {
|
||||
const relationshipsSelf = await Relationship.find({ where: { from_id: user_id, type: RelationshipType.friends } });
|
||||
const relationshipsSelf = await Relationship.find({ where: { from_id: req.user_id, type: RelationshipType.friends } });
|
||||
const relationshipsUser = await Relationship.find({ where: { from_id: user_id, type: RelationshipType.friends } });
|
||||
const relationshipsIntersection = relationshipsSelf.filter((r1) => relationshipsUser.some((r2) => r2.to_id === r1.to_id));
|
||||
if (with_mutual_friends_count) mutual_friends_count = relationshipsIntersection.length;
|
||||
|
||||
Reference in New Issue
Block a user