[mastodon-client] Fix own user following/followers when ffVisibility is restricted

This commit is contained in:
Laura Hausmann 2023-09-24 20:03:19 +02:00
parent 97067648e8
commit dd0875e517
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -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(