chore: Refactor feature flags (#13734)

Co-authored-by: Omar López <[email protected]>
This commit is contained in:
ErikandOmar López authored and GitHub committed 2024-02-20 21:49:48 -03:00
1 parent 75d5576e17
commit 83ceb46cca
11 files changed
+85 -38

No files matched your search

+5 -5
View File
@@ -6,7 +6,7 @@ import {
sendEmailVerificationLink,
sendChangeOfEmailVerificationLink,
} from "@calcom/emails/email-manager";
import { getFeatureFlagMap } from "@calcom/features/flags/server/utils";
import { getFeatureFlag } from "@calcom/features/flags/server/utils";
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
import { WEBAPP_URL } from "@calcom/lib/constants";
import logger from "@calcom/lib/logger";
@@ -24,9 +24,9 @@ interface VerifyEmailType {
export const sendEmailVerification = async ({ email, language, username }: VerifyEmailType) => {
const token = randomBytes(32).toString("hex");
const translation = await getTranslation(language ?? "en", "common");
const flags = await getFeatureFlagMap(prisma);
const emailVerification = await getFeatureFlag(prisma, "email-verification");
if (!flags["email-verification"]) {
if (!emailVerification) {
log.warn("Email verification is disabled - Skipping");
return { ok: true, skipped: true };
}
@@ -93,9 +93,9 @@ interface ChangeOfEmail {
export const sendChangeOfEmailVerification = async ({ user, language }: ChangeOfEmail) => {
const token = randomBytes(32).toString("hex");
const translation = await getTranslation(language ?? "en", "common");
const flags = await getFeatureFlagMap(prisma);
const emailVerification = await getFeatureFlag(prisma, "email-verification");
if (!flags["email-verification"]) {
if (!emailVerification) {
log.warn("Email verification is disabled - Skipping");
return { ok: true, skipped: true };
}