From bf699cdf109d6fb59f4104ddced9837992bf68ea Mon Sep 17 00:00:00 2001 From: ElementRobot Date: Wed, 21 Dec 2022 16:16:51 +0000 Subject: [PATCH] [Backport staging] Make threads disabled by default (#9815) * Make threads disable by default * restore e2ee tests * fix threads e2e spec for beta joining (cherry picked from commit 134e3d7ae853088d0765444837637669c9f6bb34) Co-authored-by: Germain --- cypress/e2e/polls/polls.spec.ts | 1 + cypress/e2e/threads/threads.spec.ts | 36 +++++++++++++++++++++++++++++ src/settings/Settings.tsx | 2 +- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/polls/polls.spec.ts b/cypress/e2e/polls/polls.spec.ts index fd8ad33056..ce0962410c 100644 --- a/cypress/e2e/polls/polls.spec.ts +++ b/cypress/e2e/polls/polls.spec.ts @@ -77,6 +77,7 @@ describe("Polls", () => { }; beforeEach(() => { + cy.enableLabsFeature("feature_threadstable"); cy.window().then((win) => { win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests }); diff --git a/cypress/e2e/threads/threads.spec.ts b/cypress/e2e/threads/threads.spec.ts index 6736df35b1..7b616bd13f 100644 --- a/cypress/e2e/threads/threads.spec.ts +++ b/cypress/e2e/threads/threads.spec.ts @@ -19,10 +19,17 @@ limitations under the License. import { SynapseInstance } from "../../plugins/synapsedocker"; import { MatrixClient } from "../../global"; +function markWindowBeforeReload(): void { + // mark our window object to "know" when it gets reloaded + cy.window().then((w) => (w.beforeReload = true)); +} + describe("Threads", () => { let synapse: SynapseInstance; beforeEach(() => { + // Default threads to ON for this spec + cy.enableLabsFeature("feature_threadstable"); cy.window().then((win) => { win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests }); @@ -37,6 +44,35 @@ describe("Threads", () => { cy.stopSynapse(synapse); }); + it("should reload when enabling threads beta", () => { + markWindowBeforeReload(); + + // Turn off + cy.openUserSettings("Labs").within(() => { + // initially the new property is there + cy.window().should("have.prop", "beforeReload", true); + + cy.leaveBeta("Threaded messages"); + cy.wait(1000); + // after reload the property should be gone + cy.window().should("not.have.prop", "beforeReload"); + }); + + cy.get(".mx_MatrixChat", { timeout: 15000 }); // wait for the app + markWindowBeforeReload(); + + // Turn on + cy.openUserSettings("Labs").within(() => { + // initially the new property is there + cy.window().should("have.prop", "beforeReload", true); + + cy.joinBeta("Threaded messages"); + cy.wait(1000); + // after reload the property should be gone + cy.window().should("not.have.prop", "beforeReload"); + }); + }); + it("should be usable for a conversation", () => { let bot: MatrixClient; cy.getBot(synapse, { diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 3a4a6ef8c3..1ec6b3562f 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -261,7 +261,7 @@ export const SETTINGS: { [setting: string]: ISetting } = { controller: new ThreadBetaController(), displayName: _td("Threaded messages"), supportedLevels: LEVELS_FEATURE, - default: true, + default: false, betaInfo: { title: _td("Threaded messages"), caption: () => (