🧵 Enable threads by default (#9736)

* Delabs threads

* remove threads reload when labs is toggled

* Fix ts strict

* fix rebase mistake

* remove .only

* fix pr comments

* re-introduce backwards compat

* Fix export test

* Fix SearchREsultTile test

* strict ts
This commit is contained in:
Germain 2022-12-13 15:09:15 +00:00 committed by GitHub
parent 9668a24ca7
commit 2d2755d145
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 88 additions and 170 deletions

View file

@ -169,6 +169,7 @@ describe("TimelinePanel", () => {
const getValueCopy = SettingsStore.getValue;
SettingsStore.getValue = jest.fn().mockImplementation((name: string) => {
if (name === "sendReadReceipts") return true;
if (name === "feature_threadstable") return false;
return getValueCopy(name);
});
@ -182,6 +183,7 @@ describe("TimelinePanel", () => {
const getValueCopy = SettingsStore.getValue;
SettingsStore.getValue = jest.fn().mockImplementation((name: string) => {
if (name === "sendReadReceipts") return false;
if (name === "feature_threadstable") return false;
return getValueCopy(name);
});
@ -358,7 +360,7 @@ describe("TimelinePanel", () => {
client.supportsExperimentalThreads = () => true;
const getValueCopy = SettingsStore.getValue;
SettingsStore.getValue = jest.fn().mockImplementation((name: string) => {
if (name === "feature_thread") return true;
if (name === "feature_threadstable") return true;
return getValueCopy(name);
});

View file

@ -386,6 +386,12 @@ describe("<MessageActionBar />", () => {
});
describe("when threads feature is not enabled", () => {
beforeEach(() => {
jest.spyOn(SettingsStore, "getValue").mockImplementation(
(setting) => setting !== "feature_threadstable",
);
});
it("does not render thread button when threads does not have server support", () => {
jest.spyOn(SettingsStore, "getValue").mockReturnValue(false);
Thread.setServerSideSupport(FeatureSupport.None);
@ -416,7 +422,9 @@ describe("<MessageActionBar />", () => {
describe("when threads feature is enabled", () => {
beforeEach(() => {
jest.spyOn(SettingsStore, "getValue").mockImplementation((setting) => setting === "feature_thread");
jest.spyOn(SettingsStore, "getValue").mockImplementation(
(setting) => setting === "feature_threadstable",
);
});
it("renders thread button on own actionable event", () => {

View file

@ -40,7 +40,7 @@ describe("RoomHeaderButtons-test.tsx", function () {
});
jest.spyOn(SettingsStore, "getValue").mockImplementation((name: string) => {
if (name === "feature_thread") return true;
if (name === "feature_threadstable") return true;
});
});

View file

@ -73,7 +73,7 @@ describe("EventTile", () => {
jest.spyOn(client, "getRoom").mockReturnValue(room);
jest.spyOn(client, "decryptEventIfNeeded").mockResolvedValue();
jest.spyOn(SettingsStore, "getValue").mockImplementation((name) => name === "feature_thread");
jest.spyOn(SettingsStore, "getValue").mockImplementation((name) => name === "feature_threadstable");
mxEvent = mkMessage({
room: room.roomId,

View file

@ -19,14 +19,21 @@ import { SearchResult } from "matrix-js-sdk/src/models/search-result";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { render } from "@testing-library/react";
import { Room } from "matrix-js-sdk/src/models/room";
import { createTestClient } from "../../../test-utils";
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
import { stubClient } from "../../../test-utils";
import SearchResultTile from "../../../../src/components/views/rooms/SearchResultTile";
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
const ROOM_ID = "!qPewotXpIctQySfjSy:localhost";
describe("SearchResultTile", () => {
beforeAll(() => {
MatrixClientPeg.get = () => createTestClient();
stubClient();
const cli = MatrixClientPeg.get();
const room = new Room(ROOM_ID, cli, "@bob:example.org");
jest.spyOn(cli, "getRoom").mockReturnValue(room);
});
it("Sets up appropriate callEventGrouper for m.call. events", () => {
@ -44,7 +51,7 @@ describe("SearchResultTile", () => {
},
event_id: "$144429830826TWwbB:localhost",
origin_server_ts: 1432735824653,
room_id: "!qPewotXpIctQySfjSy:localhost",
room_id: ROOM_ID,
sender: "@example:example.org",
type: "m.room.message",
unsigned: {
@ -59,7 +66,7 @@ describe("SearchResultTile", () => {
{
type: EventType.CallInvite,
sender: "@user1:server",
room_id: "!qPewotXpIctQySfjSy:localhost",
room_id: ROOM_ID,
origin_server_ts: 1432735824652,
content: { call_id: "call.1" },
event_id: "$1:server",
@ -69,7 +76,7 @@ describe("SearchResultTile", () => {
{
type: EventType.CallAnswer,
sender: "@user2:server",
room_id: "!qPewotXpIctQySfjSy:localhost",
room_id: ROOM_ID,
origin_server_ts: 1432735824654,
content: { call_id: "call.1" },
event_id: "$2:server",

View file

@ -80,7 +80,7 @@ exports[`<SecurityUserSettingsTab /> renders settings marked as beta as beta car
class="mx_BetaCard_title"
>
<span>
Threads
Threaded messages
</span>
<span
class="mx_BetaCard_betaPill"
@ -124,9 +124,6 @@ exports[`<SecurityUserSettingsTab /> renders settings marked as beta as beta car
>
Joining the beta will reload .
</div>
<div
class="mx_BetaCard_faq"
/>
</div>
<div
class="mx_BetaCard_columns_image_wrapper"
@ -134,7 +131,6 @@ exports[`<SecurityUserSettingsTab /> renders settings marked as beta as beta car
<img
alt=""
class="mx_BetaCard_columns_image"
src="image-file-stub"
/>
</div>
</div>