Scheduling infrastructure for absolutely everyone.
refactor: update i18n keys to match effectiveReason values (#27381)
Eunjae Lee18049bc1d6b1
diff --git a/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.ts b/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.tsindex cc4650ba677..548fc89c339 100644--- a/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.ts+++ b/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.ts@@ -55,7 +55,7 @@ function createTeamBlockedWarningFn(return (feature: NormalizedFeature): string | null => {const blockingState = blockingStateMap.get(feature.slug);if (blockingState?.orgState === "disabled") {- return t("feature_blocked_by_org_warning");+ return t("feature_org_disabled");}return null;};diff --git a/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.ts b/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.tsindex 7f899d3b842..f4e1ee5ad72 100644--- a/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.ts+++ b/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.ts@@ -41,22 +41,18 @@ function normalizeUserFeatures(data: UserFeatureData[] | undefined): NormalizedF}));}+const WARNING_REASONS: Set<string> = new Set([+ "feature_org_disabled",+ "feature_all_teams_disabled",+ "feature_any_team_disabled",+ "feature_no_explicit_enablement",+ "feature_user_only_not_allowed",+]);+function createUserBlockedWarningFn(t: TFunction): (feature: NormalizedFeature) => string | null {return (feature: NormalizedFeature): string | null => {- if (!feature.effectiveReason) return null;- switch (feature.effectiveReason) {- case "feature_org_disabled":- return t("feature_blocked_by_org_warning");- case "feature_all_teams_disabled":- case "feature_any_team_disabled":- return t("feature_blocked_by_team_warning");- case "feature_no_explicit_enablement":- return t("feature_no_explicit_enablement_warning");- case "feature_user_only_not_allowed":- return t("feature_user_only_not_allowed_warning");- default:- return null;- }+ if (!feature.effectiveReason || !WARNING_REASONS.has(feature.effectiveReason)) return null;+ return t(feature.effectiveReason);};}diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 6ddc5fc9efe..df04761628b 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -4502,10 +4502,11 @@"auto_opt_in_experimental_description_personal": "Automatically opt into new experimental features, unless disabled by your team or organization","auto_opt_in_experimental_description_team": "Automatically opt team members into new experimental features, unless configured by the organization or opted out by members","auto_opt_in_experimental_description_org": "Automatically opt organization members into new experimental features, unless configured at team or user level",- "feature_blocked_by_team_warning": "This feature is disabled by your team.",- "feature_blocked_by_org_warning": "This feature is disabled by your organization.",- "feature_no_explicit_enablement_warning": "Turn it on for yourself, or ask your team or organization admin to enable it for everyone.",- "feature_user_only_not_allowed_warning": "This feature needs approval from your team or organization.",+ "feature_org_disabled": "This feature is disabled by your organization.",+ "feature_all_teams_disabled": "This feature is disabled by your team.",+ "feature_any_team_disabled": "This feature is disabled by your team.",+ "feature_no_explicit_enablement": "Turn it on for yourself, or ask your team or organization admin to enable it for everyone.",+ "feature_user_only_not_allowed": "This feature needs approval from your team or organization.","no_opt_in_features_available": "No opt-in features are currently available","enabled_via_auto_opt_in": "Enabled via auto opt-in","account_already_exists_please_login": "An account with this email already exists. Please log in to accept the invitation.",