fix: remove stripe metadata and more logos (#11489)
This commit is contained in:
1 parent
f414428dfe
commit
0d653afd0c
7 files changed
+27
-30
No files matched your search
@@ -84,7 +84,7 @@ const ProfileView = () => {
|
||||
});
|
||||
|
||||
const { data: team, isLoading } = trpc.viewer.teams.get.useQuery(
|
||||
{ teamId },
|
||||
{ teamId, includeTeamLogo: true },
|
||||
{
|
||||
enabled: !!teamId,
|
||||
onError: () => {
|
||||
@@ -95,6 +95,7 @@ const ProfileView = () => {
|
||||
form.setValue("name", team.name || "");
|
||||
form.setValue("slug", team.slug || "");
|
||||
form.setValue("bio", team.bio || "");
|
||||
form.setValue("logo", team.logo || "");
|
||||
if (team.slug === null && (team?.metadata as Prisma.JsonObject)?.requestedSlug) {
|
||||
form.setValue("slug", ((team?.metadata as Prisma.JsonObject)?.requestedSlug as string) || "");
|
||||
}
|
||||
@@ -167,6 +168,7 @@ const ProfileView = () => {
|
||||
name: values.name,
|
||||
slug: values.slug,
|
||||
bio: values.bio,
|
||||
logo: values.logo,
|
||||
};
|
||||
objectKeys(variables).forEach((key) => {
|
||||
if (variables[key as keyof typeof variables] === team?.[key]) delete variables[key];
|
||||
|
||||
@@ -15,10 +15,11 @@ export async function getTeamWithMembers(args: {
|
||||
slug?: string;
|
||||
userId?: number;
|
||||
orgSlug?: string | null;
|
||||
includeTeamLogo?: boolean;
|
||||
isTeamView?: boolean;
|
||||
isOrgView?: boolean;
|
||||
}) {
|
||||
const { id, slug, userId, orgSlug, isTeamView, isOrgView } = args;
|
||||
const { id, slug, userId, orgSlug, isTeamView, isOrgView, includeTeamLogo } = args;
|
||||
const userSelect = Prisma.validator<Prisma.UserSelect>()({
|
||||
username: true,
|
||||
email: true,
|
||||
@@ -54,6 +55,7 @@ export async function getTeamWithMembers(args: {
|
||||
id: true,
|
||||
name: true,
|
||||
slug: true,
|
||||
...(!!includeTeamLogo ? { logo: true } : {}),
|
||||
bio: true,
|
||||
hideBranding: true,
|
||||
hideBookATeamMember: true,
|
||||
@@ -64,13 +66,11 @@ export async function getTeamWithMembers(args: {
|
||||
id: true,
|
||||
slug: true,
|
||||
name: true,
|
||||
logo: true,
|
||||
},
|
||||
},
|
||||
children: {
|
||||
select: {
|
||||
name: true,
|
||||
logo: true,
|
||||
slug: true,
|
||||
},
|
||||
},
|
||||
@@ -168,9 +168,18 @@ export async function getTeamWithMembers(args: {
|
||||
...eventType,
|
||||
metadata: EventTypeMetaDataSchema.parse(eventType.metadata),
|
||||
}));
|
||||
/** Don't leak invite tokens to the frontend */
|
||||
// Don't leak invite tokens to the frontend
|
||||
const { inviteTokens, ...teamWithoutInviteTokens } = team;
|
||||
|
||||
// Don't leak stripe payment ids
|
||||
const teamMetadata = teamMetadataSchema.parse(team.metadata);
|
||||
const {
|
||||
paymentId: _,
|
||||
subscriptionId: __,
|
||||
subscriptionItemId: ___,
|
||||
...restTeamMetadata
|
||||
} = teamMetadata || {};
|
||||
|
||||
return {
|
||||
...teamWithoutInviteTokens,
|
||||
/** To prevent breaking we only return non-email attached token here, if we have one */
|
||||
@@ -179,7 +188,7 @@ export async function getTeamWithMembers(args: {
|
||||
token.identifier === "invite-link-for-teamId-" + team.id &&
|
||||
token.expires > new Date(new Date().setHours(24))
|
||||
),
|
||||
metadata: teamMetadataSchema.parse(team.metadata),
|
||||
metadata: restTeamMetadata,
|
||||
eventTypes: !isOrgView ? eventTypes : null,
|
||||
members,
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ export const getHandler = async ({ ctx, input }: GetOptions) => {
|
||||
const team = await getTeamWithMembers({
|
||||
id: input.teamId,
|
||||
userId: ctx.user.organization?.isOrgAdmin ? undefined : ctx.user.id,
|
||||
includeTeamLogo: input.includeTeamLogo,
|
||||
});
|
||||
|
||||
if (!team) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { z } from "zod";
|
||||
|
||||
export const ZGetInputSchema = z.object({
|
||||
teamId: z.number(),
|
||||
includeTeamLogo: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export type TGetInputSchema = z.infer<typeof ZGetInputSchema>;
|
||||
@@ -22,13 +22,8 @@ export function UnpublishedEntity(props: UnpublishedEntityProps) {
|
||||
}
|
||||
headline={t("team_is_unpublished", {
|
||||
team: props.name,
|
||||
defaultValue: `${props.name} is unpublished`,
|
||||
})}
|
||||
description={t(`${props.orgSlug ? "org" : "team"}_is_unpublished_description`, {
|
||||
defaultValue: `This ${
|
||||
props.orgSlug ? "organization" : "team"
|
||||
} link is currently not available. Please contact the organization owner or ask them to publish it.`,
|
||||
})}
|
||||
description={t(`${props.orgSlug ? "org" : "team"}_is_unpublished_description`)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user