Prioritizes published teams over unpublished ones (#8177)
This commit is contained in:
1 parent
543e526568
commit
636ee7b8a1
1 file changed
+12
-12
@@ -157,16 +157,20 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
|||||||
const ssr = await ssrInit(context);
|
const ssr = await ssrInit(context);
|
||||||
const slug = Array.isArray(context.query?.slug) ? context.query.slug.pop() : context.query.slug;
|
const slug = Array.isArray(context.query?.slug) ? context.query.slug.pop() : context.query.slug;
|
||||||
|
|
||||||
const unpublishedTeam = await prisma.team.findFirst({
|
const team = await getTeamWithMembers(undefined, slug);
|
||||||
where: {
|
|
||||||
metadata: {
|
if (!team) {
|
||||||
path: ["requestedSlug"],
|
const unpublishedTeam = await prisma.team.findFirst({
|
||||||
equals: slug,
|
where: {
|
||||||
|
metadata: {
|
||||||
|
path: ["requestedSlug"],
|
||||||
|
equals: slug,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
if (!unpublishedTeam) return { notFound: true } as const;
|
||||||
|
|
||||||
if (unpublishedTeam) {
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
isUnpublished: true,
|
isUnpublished: true,
|
||||||
@@ -176,10 +180,6 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
|||||||
} as const;
|
} as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
const team = await getTeamWithMembers(undefined, slug);
|
|
||||||
|
|
||||||
if (!team) return { notFound: true } as { notFound: true };
|
|
||||||
|
|
||||||
team.eventTypes = team.eventTypes.map((type) => ({
|
team.eventTypes = team.eventTypes.map((type) => ({
|
||||||
...type,
|
...type,
|
||||||
users: type.users.map((user) => ({
|
users: type.users.map((user) => ({
|
||||||
|
|||||||
Reference in new issue
Block a user