fix: checks for free limit reached (#1786)

This commit is contained in:
Shubham Palriwala
2023-12-15 18:40:46 +05:30
committed by GitHub
parent 8dd67ec484
commit f28bb9b82a
4 changed files with 5 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ export const getUpdatedState = async (environmentId: string, personId?: string):
if (IS_FORMBRICKS_CLOUD) {
const hasUserTargetingSubscription =
team?.billing?.features.userTargeting.status &&
team?.billing?.features.userTargeting.status in ["active", "canceled"];
["active", "canceled"].includes(team?.billing?.features.userTargeting.status);
const currentMau = await getMonthlyActiveTeamPeopleCount(team.id);
const isMauLimitReached = !hasUserTargetingSubscription && currentMau >= PRICING_USERTARGETING_FREE_MTU;
if (isMauLimitReached) {
@@ -80,7 +80,7 @@ export const getUpdatedState = async (environmentId: string, personId?: string):
if (IS_FORMBRICKS_CLOUD) {
const hasAppSurveySubscription =
team?.billing?.features.inAppSurvey.status &&
team?.billing?.features.inAppSurvey.status in ["active", "canceled"];
["active", "canceled"].includes(team?.billing?.features.inAppSurvey.status);
const monthlyResponsesCount = await getMonthlyTeamResponseCount(team.id);
isAppSurveyLimitReached =
IS_FORMBRICKS_CLOUD &&

View File

@@ -67,7 +67,7 @@ export async function GET(
}
const hasUserTargetingSubscription =
team?.billing?.features.userTargeting.status &&
team?.billing?.features.userTargeting.status in ["active", "canceled"];
["active", "canceled"].includes(team?.billing?.features.userTargeting.status);
const currentMau = await getMonthlyActiveTeamPeopleCount(team.id);
isMauLimitReached = !hasUserTargetingSubscription && currentMau >= PRICING_USERTARGETING_FREE_MTU;
}

View File

@@ -106,7 +106,7 @@ export async function POST(req: NextRequest, context: Context): Promise<NextResp
}
try {
const plan = team.billing.features.linkSurvey.status in ["active", "canceled"] ? "pro" : "free";
const plan = ["active", "canceled"].includes(team.billing.features.linkSurvey.status) ? "pro" : "free";
const bytes = await file.arrayBuffer();
const fileBuffer = Buffer.from(bytes);

View File

@@ -49,7 +49,7 @@ export async function POST(req: NextRequest, context: Context): Promise<NextResp
return responses.notFoundResponse("TeamByEnvironmentId", environmentId);
}
const plan = team.billing.features.linkSurvey.status in ["active", "canceled"] ? "pro" : "free";
const plan = ["active", "canceled"].includes(team.billing.features.linkSurvey.status) ? "pro" : "free";
return await uploadPrivateFile(fileName, environmentId, fileType, plan);
}