diff --git a/apps/web/pages/[user]/[type].tsx b/apps/web/pages/[user]/[type].tsx index 48773abc0d..ac29116e8d 100644 --- a/apps/web/pages/[user]/[type].tsx +++ b/apps/web/pages/[user]/[type].tsx @@ -4,7 +4,7 @@ import { JSONObject } from "superjson/dist/types"; import { z } from "zod"; import { privacyFilteredLocations, LocationObject } from "@calcom/app-store/locations"; -import { WEBAPP_URL } from "@calcom/lib/constants"; +import { IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants"; import { getDefaultEvent, getGroupName, getUsernameList } from "@calcom/lib/defaultEvents"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent"; @@ -157,9 +157,10 @@ async function getUserPageProps(context: GetStaticPropsContext) { // Check if the user you are logging into has any active teams const hasActiveTeam = user.teams.filter((m) => { + if (!IS_TEAM_BILLING_ENABLED) return true; const metadata = teamMetadataSchema.safeParse(m.team.metadata); - if (metadata.success && metadata.data?.subscriptionId) return false; - return true; + if (metadata.success && metadata.data?.subscriptionId) return true; + return false; }).length > 0; return { diff --git a/apps/web/pages/api/auth/[...nextauth].tsx b/apps/web/pages/api/auth/[...nextauth].tsx index f7716fdccc..39b9b75c9f 100644 --- a/apps/web/pages/api/auth/[...nextauth].tsx +++ b/apps/web/pages/api/auth/[...nextauth].tsx @@ -14,7 +14,7 @@ import checkLicense from "@calcom/features/ee/common/server/checkLicense"; import ImpersonationProvider from "@calcom/features/ee/impersonation/lib/ImpersonationProvider"; import { hostedCal, isSAMLLoginEnabled } from "@calcom/features/ee/sso/lib/saml"; import { ErrorCode, isPasswordValid, verifyPassword } from "@calcom/lib/auth"; -import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants"; +import { APP_NAME, IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants"; import { symmetricDecrypt } from "@calcom/lib/crypto"; import { defaultCookies } from "@calcom/lib/default-cookies"; import rateLimit from "@calcom/lib/rateLimit"; @@ -125,9 +125,10 @@ const providers: Provider[] = [ // Check if the user you are logging into has any active teams const hasActiveTeams = user.teams.filter((m) => { + if (!IS_TEAM_BILLING_ENABLED) return true; const metadata = teamMetadataSchema.safeParse(m.team.metadata); - if (metadata.success && metadata.data?.subscriptionId) return false; - return true; + if (metadata.success && metadata.data?.subscriptionId) return true; + return false; }).length > 0; // authentication success- but does it meet the minimum password requirements? diff --git a/apps/web/pages/settings/my-account/appearance.tsx b/apps/web/pages/settings/my-account/appearance.tsx index 4074afe7ce..2d5aa8dc6e 100644 --- a/apps/web/pages/settings/my-account/appearance.tsx +++ b/apps/web/pages/settings/my-account/appearance.tsx @@ -189,7 +189,7 @@ const AppearanceView = () => { onCheckedChange={(checked) => formMethods.setValue("hideBranding", checked, { shouldDirty: true }) } - checked={value} + checked={!session.data?.user.belongsToActiveTeam ? false : value} /> diff --git a/packages/features/ee/teams/pages/team-appearance-view.tsx b/packages/features/ee/teams/pages/team-appearance-view.tsx index 2daee4274f..5de3db0ffd 100644 --- a/packages/features/ee/teams/pages/team-appearance-view.tsx +++ b/packages/features/ee/teams/pages/team-appearance-view.tsx @@ -34,11 +34,6 @@ const ProfileView = () => { onError: () => { router.push("/settings"); }, - onSuccess: (team) => { - if (team) { - form.setValue("hideBranding", team.hideBranding); - } - }, } ); @@ -55,10 +50,7 @@ const ProfileView = () => { form={form} handleSubmit={(values) => { if (team) { - const hideBranding = form.getValues("hideBranding"); - if (team.hideBranding !== hideBranding) { - mutation.mutate({ id: team.id, hideBranding }); - } + mutation.mutate({ id: team.id, hideBranding: values.hideBranding }); } }}>