Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

bug fixes

daniel31x137ca574b76f82
diff --git a/components/InputSelect/styles.ts b/components/InputSelect/styles.ts
index f05f4a51..369366ce 100644
--- a/components/InputSelect/styles.ts
+++ b/components/InputSelect/styles.ts
@@ -16,6 +16,10 @@ export const styles: StylesConfig = {
},
transition: "all 100ms",
}),
+ menu: (styles) => ({
+ ...styles,
+ zIndex: 10,
+ }),
control: (styles, state) => ({
...styles,
fontFamily: font,
diff --git a/hooks/store/publicTags.tsx b/hooks/store/publicTags.tsx
index aedeb75f..cf89491e 100644
--- a/hooks/store/publicTags.tsx
+++ b/hooks/store/publicTags.tsx
@@ -23,7 +23,6 @@ const usePublicTags = (): UseQueryResult<TagIncludingCount[]> => {
const data = await response.json();
return data.response;
},
- enabled: status === "authenticated",
});
};
diff --git a/lib/api/controllers/tags/getTags.ts b/lib/api/controllers/tags/getTags.ts
index 90c9f30e..21d1df36 100644
--- a/lib/api/controllers/tags/getTags.ts
+++ b/lib/api/controllers/tags/getTags.ts
@@ -7,8 +7,9 @@ export default async function getTags({
userId?: number;
collectionId?: number;
}) {
- // Remove empty tags
- if (userId)
+ console.log("collectionId", collectionId);
+ if (userId) {
+ // Remove empty tags
await prisma.tag.deleteMany({
where: {
ownerId: userId,
@@ -18,43 +19,56 @@ export default async function getTags({
},
});
- const tags = await prisma.tag.findMany({
- where: {
- OR: [
- { ownerId: userId }, // Tags owned by the user
- {
- links: {
- some: {
- collection: {
- members: {
- some: {
- userId, // Tags from collections where the user is a member
+ const tags = await prisma.tag.findMany({
+ where: {
+ OR: [
+ { ownerId: userId }, // Tags owned by the user
+ {
+ links: {
+ some: {
+ collection: {
+ members: {
+ some: {
+ userId, // Tags from collections where the user is a member
+ },
},
},
},
},
},
+ ],
+ },
+ include: {
+ _count: {
+ select: { links: true },
},
- {
- links: {
- some: {
- collectionId,
+ },
+ // orderBy: {
+ // links: {
+ // _count: "desc",
+ // },
+ // },
+ });
+
+ return { response: tags, status: 200 };
+ } else if (collectionId) {
+ const tags = await prisma.tag.findMany({
+ where: {
+ links: {
+ some: {
+ collection: {
+ id: collectionId,
},
},
},
- ],
- },
- include: {
- _count: {
- select: { links: true },
},
- },
- // orderBy: {
- // links: {
- // _count: "desc",
- // },
- // },
- });
+ include: {
+ _count: {
+ select: { links: true },
+ },
+ },
+ });
- return { response: tags, status: 200 };
+ return { response: tags, status: 200 };
+ }
}
diff --git a/lib/shared/schemaValidation.ts b/lib/shared/schemaValidation.ts
index bc6d445d..de3c8299 100644
--- a/lib/shared/schemaValidation.ts
+++ b/lib/shared/schemaValidation.ts
@@ -81,7 +81,7 @@ export const UpdateUserSchema = () => {
collectionOrder: z.array(z.number()).optional(),
linksRouteTo: z.nativeEnum(LinksRouteTo).optional(),
whitelistedUsers: z.array(z.string().max(50)).optional(),
- referredBy: z.string().max(100).optional(),
+ referredBy: z.string().max(100).nullish(),
});
};
diff --git a/pages/api/v1/public/collections/tags/index.ts b/pages/api/v1/public/collections/tags/index.ts
index 43e693c1..9b8217d4 100644
--- a/pages/api/v1/public/collections/tags/index.ts
+++ b/pages/api/v1/public/collections/tags/index.ts
@@ -37,6 +37,6 @@ export default async function collections(
collectionId: collection.id,
});
- return res.status(tags.status).json({ response: tags.response });
+ return res.status(tags?.status || 500).json({ response: tags?.response });
}
}