From b751fd7b9e705c5d94592718d121f80e8db20b15 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 7 May 2026 17:01:04 +0800 Subject: [PATCH] feat(settings): enable Pad-wide Settings by default; fix misleading modal title (#7679) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(settings): enable Pad-wide Settings by default; fix misleading modal title The creator-owned Pad-wide Settings feature (#7545) shipped behind a flag that defaulted to false. With the flag off the modal still rendered an H1 of `pad.settings.padSettings` ("Pad-wide Settings") for *every* user, even though no pad-wide controls were ever shown. Two readers in different browsers both saw "Pad-wide Settings" as the modal title, which looked like a creator-gate regression but was just a copy bug. Two changes: 1. Flip the default of `enablePadWideSettings` to `true` (Settings.ts plus both settings templates). With the feature on, the creator (revision-0 author) gets a real "Pad-wide Settings" section gated by `clientVars.canEditPadSettings`, while every other user sees only "User Settings" — matching the design intent of #7545. This is a behavior change, so the settings comments are expanded to describe what the toggle now does. 2. Drop the conditional H1 in `src/templates/pad.html` and always use `pad.settings.title` ("Settings"). Operators who explicitly disable the feature shouldn't see a label that lies about a section that isn't rendered. Adds backend regression coverage in `tests/backend/specs/socketio.ts`: - Different browsers (different cookie jars => different authorIDs): only the first joiner gets `canEditPadSettings: true`. - Same browser, two tabs (shared HttpOnly token cookie => same authorID): both connections are the same identity, both correctly land on the creator path. * test(settings): regression coverage for the settings modal H1 Asserts the rendered `/p/` HTML always uses `data-l10n-id="pad.settings.title"` for the modal heading, regardless of `enablePadWideSettings`. Catches a re-introduction of the old conditional that printed "Pad-wide Settings" for every user when the feature was off. Action of Qodo review feedback on PR #7679. --- settings.json.docker | 7 ++- settings.json.template | 7 ++- src/node/utils/Settings.ts | 2 +- src/templates/pad.html | 4 -- .../backend/specs/settingsModalHeading.ts | 45 ++++++++++++++ src/tests/backend/specs/socketio.ts | 62 ++++++++++++++++++- 6 files changed, 117 insertions(+), 10 deletions(-) create mode 100644 src/tests/backend/specs/settingsModalHeading.ts diff --git a/settings.json.docker b/settings.json.docker index 8755d99e3..d640536a8 100644 --- a/settings.json.docker +++ b/settings.json.docker @@ -247,9 +247,12 @@ /** * Enable creator-owned Pad-wide Settings and new-pad default seeding from My View. - * Disabled by default to preserve the legacy single-settings behavior. + * The pad creator (revision-0 author) gets the "Pad-wide Settings" section, + * which lets them set defaults and optionally enforce them for other users. + * Other users see only "User Settings" (their own view options). + * Set to false to revert to the legacy single-settings behavior. **/ - "enablePadWideSettings": "${ENABLE_PAD_WIDE_SETTINGS:false}", + "enablePadWideSettings": "${ENABLE_PAD_WIDE_SETTINGS:true}", /* * Optional privacy banner. See settings.json.template for full field docs. diff --git a/settings.json.template b/settings.json.template index 209b1721f..61be12fbf 100644 --- a/settings.json.template +++ b/settings.json.template @@ -733,9 +733,12 @@ /** * Enable creator-owned Pad-wide Settings and new-pad default seeding from My View. - * Disabled by default to preserve the legacy single-settings behavior. + * The pad creator (revision-0 author) gets the "Pad-wide Settings" section, + * which lets them set defaults and optionally enforce them for other users. + * Other users see only "User Settings" (their own view options). + * Set to false to revert to the legacy single-settings behavior. **/ - "enablePadWideSettings": "${ENABLE_PAD_WIDE_SETTINGS:false}", + "enablePadWideSettings": "${ENABLE_PAD_WIDE_SETTINGS:true}", /* * Optional privacy banner shown once the pad loads. Disabled by default. diff --git a/src/node/utils/Settings.ts b/src/node/utils/Settings.ts index 54840f03a..68f51da1f 100644 --- a/src/node/utils/Settings.ts +++ b/src/node/utils/Settings.ts @@ -369,7 +369,7 @@ const settings: SettingsType = { }, updateServer: "https://static.etherpad.org", enableDarkMode: true, - enablePadWideSettings: false, + enablePadWideSettings: true, allowPadDeletionByAllUsers: false, privacyBanner: { enabled: false, diff --git a/src/templates/pad.html b/src/templates/pad.html index ecac35ad6..5212b0046 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -127,11 +127,7 @@