Remove threads labs flag and the ability to disable threads (#9878)
This commit is contained in:
parent
a09e105c23
commit
8c22584f64
34 changed files with 197 additions and 501 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
Copyright 2022 - 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -28,7 +28,6 @@ import EventTile, { EventTileProps } from "../../../../src/components/views/room
|
|||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||
import RoomContext, { TimelineRenderingType } from "../../../../src/contexts/RoomContext";
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import SettingsStore from "../../../../src/settings/SettingsStore";
|
||||
import { getRoomContext, mkEncryptedEvent, mkEvent, mkMessage, stubClient } from "../../../test-utils";
|
||||
import { mkThread } from "../../../test-utils/threads";
|
||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||
|
@ -80,7 +79,6 @@ describe("EventTile", () => {
|
|||
|
||||
jest.spyOn(client, "getRoom").mockReturnValue(room);
|
||||
jest.spyOn(client, "decryptEventIfNeeded").mockResolvedValue();
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((name) => name === "feature_threadenabled");
|
||||
|
||||
mxEvent = mkMessage({
|
||||
room: room.roomId,
|
||||
|
|
|
@ -37,6 +37,7 @@ import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalink
|
|||
import { mockPlatformPeg } from "../../../test-utils/platform";
|
||||
import { doMaybeLocalRoomAction } from "../../../../src/utils/local-room";
|
||||
import { addTextToComposer } from "../../../test-utils/composer";
|
||||
import dis from "../../../../src/dispatcher/dispatcher";
|
||||
|
||||
jest.mock("../../../../src/utils/local-room", () => ({
|
||||
doMaybeLocalRoomAction: jest.fn(),
|
||||
|
@ -296,6 +297,54 @@ describe("<SendMessageComposer/>", () => {
|
|||
msgtype: MsgType.Text,
|
||||
});
|
||||
});
|
||||
|
||||
it("shows chat effects on message sending", () => {
|
||||
mocked(doMaybeLocalRoomAction).mockImplementation(
|
||||
<T extends {}>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
return fn(roomId);
|
||||
},
|
||||
);
|
||||
|
||||
mockPlatformPeg({ overrideBrowserShortcuts: jest.fn().mockReturnValue(false) });
|
||||
const { container } = getComponent();
|
||||
|
||||
addTextToComposer(container, "🎉");
|
||||
fireEvent.keyDown(container.querySelector(".mx_SendMessageComposer")!, { key: "Enter" });
|
||||
|
||||
expect(mockClient.sendMessage).toHaveBeenCalledWith("myfakeroom", null, {
|
||||
body: "test message",
|
||||
msgtype: MsgType.Text,
|
||||
});
|
||||
|
||||
expect(dis.dispatch).toHaveBeenCalledWith({ action: `effects.confetti` });
|
||||
});
|
||||
|
||||
it("not to send chat effects on message sending for threads", () => {
|
||||
mocked(doMaybeLocalRoomAction).mockImplementation(
|
||||
<T extends {}>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
return fn(roomId);
|
||||
},
|
||||
);
|
||||
|
||||
mockPlatformPeg({ overrideBrowserShortcuts: jest.fn().mockReturnValue(false) });
|
||||
const { container } = getComponent({
|
||||
relation: {
|
||||
rel_type: "m.thread",
|
||||
event_id: "$yolo",
|
||||
is_falling_back: true,
|
||||
},
|
||||
});
|
||||
|
||||
addTextToComposer(container, "🎉");
|
||||
fireEvent.keyDown(container.querySelector(".mx_SendMessageComposer")!, { key: "Enter" });
|
||||
|
||||
expect(mockClient.sendMessage).toHaveBeenCalledWith("myfakeroom", null, {
|
||||
body: "test message",
|
||||
msgtype: MsgType.Text,
|
||||
});
|
||||
|
||||
expect(dis.dispatch).not.toHaveBeenCalledWith({ action: `effects.confetti` });
|
||||
});
|
||||
});
|
||||
|
||||
describe("isQuickReaction", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue