From dd0875e5170d1b2c6e1dff0e3db55f5f00e70c75 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 24 Sep 2023 20:03:19 +0200 Subject: [PATCH] [mastodon-client] Fix own user following/followers when ffVisibility is restricted --- .../src/server/api/mastodon/helpers/user.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/helpers/user.ts b/packages/backend/src/server/api/mastodon/helpers/user.ts index 86efea1fb..848d41c7e 100644 --- a/packages/backend/src/server/api/mastodon/helpers/user.ts +++ b/packages/backend/src/server/api/mastodon/helpers/user.ts @@ -83,17 +83,19 @@ export class UserHelpers { const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); if (profile.ffVisibility === "private") { - if (!localUser || user.id != localUser.id) return { data: [] }; + if (!localUser || user.id !== localUser.id) return { data: [] }; } else if (profile.ffVisibility === "followers") { if (!localUser) return { data: [] }; - const isFollowed = await Followings.exist({ - where: { - followeeId: user.id, - followerId: localUser.id, - }, - }); - if (!isFollowed) return { data: [] }; + if (user.id !== localUser.id) { + const isFollowed = await Followings.exist({ + where: { + followeeId: user.id, + followerId: localUser.id, + }, + }); + if (!isFollowed) return { data: [] }; + } } const query = PaginationHelpers.makePaginationQuery(