Keep /privacy off unless the runtime flag is on, and show that link in the footer story.
A build-time public env value was enough to publish the page, and the footer interaction story still looked for a link the component hides by default.
This commit is contained in:
1 parent
072e5362f5
commit
81ad287c24
5 files changed
+15
-10
No files matched your search
+2
-2
@@ -17,9 +17,9 @@ SMTP_FROM="CommunityRule <noreply@localhost>"
|
||||
|
||||
# /privacy. Unset or any value other than `true` is off (404, no footer/login/email links).
|
||||
# Staging: `true`. Production stays off until university counsel has read the policy.
|
||||
# ENABLE_PRIVACY_POLICY is the Cloudron runtime switch. The NEXT_PUBLIC_ alias bakes at image build.
|
||||
# Only ENABLE_PRIVACY_POLICY counts. It is read at runtime on Cloudron.
|
||||
# A build-time NEXT_PUBLIC_ENABLE_PRIVACY_POLICY value does not turn the page on.
|
||||
# ENABLE_PRIVACY_POLICY=true
|
||||
# NEXT_PUBLIC_ENABLE_PRIVACY_POLICY=true
|
||||
|
||||
# CR-107: inbox for Ask an organizer form submissions (requires CLOUDRON_MAIL_SMTP_* in production).
|
||||
ORGANIZER_INQUIRY_TO=
|
||||
|
||||
@@ -81,8 +81,8 @@ per-app in the manifest and provisioned at install time.
|
||||
- `ENABLE_PRIVACY_POLICY=true` — turns on `/privacy` at runtime. Staging
|
||||
keeps this on so counsel can read the page. Leave unset in production
|
||||
until that review is done (the route 404s and public chrome does not
|
||||
link to it). `NEXT_PUBLIC_ENABLE_PRIVACY_POLICY` is the same switch
|
||||
baked at image build; prefer the runtime name on Cloudron.
|
||||
link to it). Only this runtime name counts. A build-time
|
||||
`NEXT_PUBLIC_ENABLE_PRIVACY_POLICY` value does not turn the page on.
|
||||
- `NEXT_PUBLIC_ENABLE_BACKEND_SYNC=true` — turns on Postgres draft
|
||||
persistence for signed-in users. Required in production.
|
||||
- `UPLOAD_ROOT` — absolute path to a writable directory on the Cloudron
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
/**
|
||||
* `/privacy` stays off in production until university counsel has read the
|
||||
* policy. Staging sets `ENABLE_PRIVACY_POLICY=true` (or the public alias).
|
||||
* `/privacy` stays off until university counsel has read the policy.
|
||||
* Only the runtime switch `ENABLE_PRIVACY_POLICY=true` turns it on.
|
||||
* A build-time `NEXT_PUBLIC_ENABLE_PRIVACY_POLICY` value does not.
|
||||
* Unset or any other value is off.
|
||||
*/
|
||||
export function isPrivacyPolicyEnabled(): boolean {
|
||||
return (
|
||||
process.env.ENABLE_PRIVACY_POLICY === "true" ||
|
||||
process.env.NEXT_PUBLIC_ENABLE_PRIVACY_POLICY === "true"
|
||||
);
|
||||
return process.env.ENABLE_PRIVACY_POLICY === "true";
|
||||
}
|
||||
|
||||
/** Absolute /privacy URL, or null while the flag is off. */
|
||||
|
||||
@@ -188,6 +188,9 @@ export const FullHD = {
|
||||
|
||||
// Interactive story for testing user interactions
|
||||
export const Interactive = {
|
||||
args: {
|
||||
privacyEnabled: true,
|
||||
},
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
|
||||
@@ -35,6 +35,10 @@ describe("isPrivacyPolicyEnabled", () => {
|
||||
|
||||
delete process.env.ENABLE_PRIVACY_POLICY;
|
||||
process.env.NEXT_PUBLIC_ENABLE_PRIVACY_POLICY = "true";
|
||||
expect(isPrivacyPolicyEnabled()).toBe(false);
|
||||
expect(privacyPolicyUrl("https://communityrule.info")).toBeNull();
|
||||
|
||||
process.env.ENABLE_PRIVACY_POLICY = "true";
|
||||
expect(isPrivacyPolicyEnabled()).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user