Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
⚖️ Link privacy policy, terms and cookie policy from the cloud app (#3551)
Luke Vella9263b550d6ef
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex 977424c86..937fdbf8a 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -216,6 +216,7 @@"continueToCheckout": "Continue to checkout","continueWithEmail": "Continue with email","controlPanel": "Control Panel",+ "cookiePolicy": "Cookie policy","copied": "Copied","copiedToClipboard": "Copied to clipboard","copy": "Copy",@@ -874,6 +875,7 @@"primaryColorDark": "Primary color (dark mode)","primaryColorSettingHint": "Used for buttons and highlights.","primaryColorSettingTitle": "Primary color",+ "privacyPolicy": "Privacy policy","profile": "Profile","profileAccount": "Account","profileDescription": "Change your profile settings",@@ -1085,6 +1087,7 @@"teamCollaborationDescription": "Invite team members with centralized billing","teamCollaborationSettingDescription": "Allow all members of this space to see and manage each other's polls, events and other content.","temporaryEmailNotAllowed": "Temporary or disposable email addresses are not allowed.",+ "termsOfUse": "Terms of use","theme": "Theme","themeDark": "Dark","themeDescription": "Choose your preferred appearance",diff --git a/apps/web/src/app/[locale]/control-panel/settings/actions.ts b/apps/web/src/app/[locale]/control-panel/settings/actions.tsindex 28d441b37..d687a9d7b 100644--- a/apps/web/src/app/[locale]/control-panel/settings/actions.ts+++ b/apps/web/src/app/[locale]/control-panel/settings/actions.ts@@ -8,8 +8,8 @@ import {footerLinksSchema,instanceSettingsSchema,} from "@/features/instance-settings/schema";-import { isSelfHosted } from "@/lib/constants";import { AppError } from "@/lib/errors/app-error";+import { isFeatureEnabled } from "@/lib/feature-flags/server";import { adminActionClient } from "@/lib/safe-action/server";export const updateInstanceSettingsAction = adminActionClient@@ -30,7 +30,7 @@ export const updateFooterLinksAction = adminActionClient// Cloud renders its own static links, so `loadFooterLinks` discards// whatever is stored. Without this, a cloud admin would save, see a// success toast, and reload into an empty form.- if (!isSelfHosted) {+ if (!isFeatureEnabled("customFooterLinks")) {throw new AppError({code: "FORBIDDEN",message: "Footer links are not available on this instance",diff --git a/apps/web/src/app/[locale]/control-panel/settings/page.tsx b/apps/web/src/app/[locale]/control-panel/settings/page.tsxindex b134791c2..fe4983ca4 100644--- a/apps/web/src/app/[locale]/control-panel/settings/page.tsx+++ b/apps/web/src/app/[locale]/control-panel/settings/page.tsx@@ -16,7 +16,7 @@ import {import { getInstanceSettings } from "@/features/instance-settings/data";import { loadFooterLinks } from "@/features/instance-settings/loaders";import { Trans } from "@/i18n/client";-import { isSelfHosted } from "@/lib/constants";+import { isFeatureEnabled } from "@/lib/feature-flags/server";import { FooterLinksField } from "./footer-links-field";import { InstanceSettingsForm } from "./instance-settings-form";@@ -69,7 +69,7 @@ export default async function InstanceSettingsPage() {<InstanceSettingsForm defaultValue={instanceSettings} /></PageSectionContent></PageSection>- {isSelfHosted ? (+ {isFeatureEnabled("customFooterLinks") ? (<PageSection variant="card"><PageSectionHeader><PageSectionTitle>diff --git a/apps/web/src/components/instance-footer-links.tsx b/apps/web/src/components/instance-footer-links.tsxindex 939dc8556..329e1e63f 100644--- a/apps/web/src/components/instance-footer-links.tsx+++ b/apps/web/src/components/instance-footer-links.tsx@@ -1,12 +1,6 @@/**- * Footer links configured by a self-hosted instance administrator, typically- * legal disclosures such as an Impressum or privacy policy.- *- * Labels are admin-typed and therefore not localised — the linked documents- * are themselves single-language, so a German Datenschutzerklärung stays- * labelled in German for an English-speaking visitor.- *- * Hrefs are validated on write and again on read (see instance-settings/data.ts).+ * Footer links carrying legal disclosures such as an Impressum or privacy+ * policy. See `loadFooterLinks` for where they come from.*/export function InstanceFooterLinks({links,diff --git a/apps/web/src/features/instance-settings/loaders.ts b/apps/web/src/features/instance-settings/loaders.tsindex 220129bc0..e644082c0 100644--- a/apps/web/src/features/instance-settings/loaders.ts+++ b/apps/web/src/features/instance-settings/loaders.ts@@ -1,7 +1,7 @@import "server-only";import { cache } from "react";-import { isSelfHosted } from "@/lib/constants";+import { getTranslation } from "@/i18n/server";import { isFeatureEnabled } from "@/lib/feature-flags/server";import { getInstanceSettings } from "./data";import { getUpdateStatus } from "./service";@@ -24,15 +24,31 @@ export const loadUpdateStatus = cache(async () => {* Footer links for the login and invite page footers.** Deliberately not routed through the branding config: these carry legal- * disclosures (Impressum, privacy policy) that self-hosted instances are- * required to make reachable, so they are not gated behind the white label- * add-on the way the rest of the branding settings are.+ * disclosures (Impressum, privacy policy) that instances are required to make+ * reachable, so they are not gated behind the white label add-on the way the+ * rest of the branding settings are.*- * Cloud has its own static links (RAL-1563) and never reads this column.+ * Cloud links Rallly's own policies, labelled per locale. Self-hosted serves+ * whatever the operator configured, labels as typed.*/export const loadFooterLinks = cache(async () => {- if (!isSelfHosted) {- return [];+ if (!isFeatureEnabled("customFooterLinks")) {+ const { t } = await getTranslation();++ return [+ {+ label: t("privacyPolicy", { defaultValue: "Privacy policy" }),+ href: "https://rallly.co/privacy-policy",+ },+ {+ label: t("termsOfUse", { defaultValue: "Terms of use" }),+ href: "https://rallly.co/terms-of-use",+ },+ {+ label: t("cookiePolicy", { defaultValue: "Cookie policy" }),+ href: "https://rallly.co/cookie-policy",+ },+ ];}const { footerLinks } = await getInstanceSettings();diff --git a/apps/web/src/lib/feature-flags/config.ts b/apps/web/src/lib/feature-flags/config.tsindex ce3798057..ad5cdd4ee 100644--- a/apps/web/src/lib/feature-flags/config.ts+++ b/apps/web/src/lib/feature-flags/config.ts@@ -53,4 +53,7 @@ export const featureFlagConfig: FeatureFlagConfig = {// Caps open polls per organizer by tier. Billing only: the ladder sells// Pro, and without billing every space already has every paid feature.openPollLimit: isOpenPollLimitEnabled,+ // Operators publish their own legal notices. Cloud links Rallly's policies+ // from source so a wrong URL goes through review, not a database row.+ customFooterLinks: isSelfHosted,};diff --git a/apps/web/src/lib/feature-flags/types.ts b/apps/web/src/lib/feature-flags/types.tsindex 23fec3d3e..1630c44d0 100644--- a/apps/web/src/lib/feature-flags/types.ts+++ b/apps/web/src/lib/feature-flags/types.ts@@ -16,6 +16,7 @@ export interface FeatureFlagConfig {updateCheck: boolean;reviewRequests: boolean;openPollLimit: boolean;+ customFooterLinks: boolean;}export type Feature = keyof FeatureFlagConfig;