bug fixed

This commit is contained in:
daniel31x13
2023-11-24 13:28:47 -05:00
parent 87196b1190
commit 676c7c3a5d
4 changed files with 47 additions and 5 deletions
@@ -29,7 +29,23 @@ export default async function getPublicUser(
(usernames) => usernames.username
);
if (user?.isPrivate) {
const isInAPublicCollection = await prisma.collection.findFirst({
where: {
["OR"]: [
{ ownerId: user.id },
{
members: {
some: {
userId: user.id,
},
},
},
],
isPublic: true,
},
});
if (user?.isPrivate && !isInAPublicCollection) {
if (requestingId) {
const requestingUser = await prisma.user.findUnique({
where: { id: requestingId },