Update to supportsThreads (#9907)
This commit is contained in:
parent
a21929dba0
commit
3e2bf5640e
15 changed files with 16 additions and 20 deletions
|
@ -218,7 +218,7 @@ class MatrixClientPegClass implements IMatrixClientPeg {
|
||||||
opts.pendingEventOrdering = PendingEventOrdering.Detached;
|
opts.pendingEventOrdering = PendingEventOrdering.Detached;
|
||||||
opts.lazyLoadMembers = true;
|
opts.lazyLoadMembers = true;
|
||||||
opts.clientWellKnownPollPeriod = 2 * 60 * 60; // 2 hours
|
opts.clientWellKnownPollPeriod = 2 * 60 * 60; // 2 hours
|
||||||
opts.experimentalThreadSupport = SettingsStore.getValue("feature_threadenabled");
|
opts.threadSupport = SettingsStore.getValue("feature_threadenabled");
|
||||||
|
|
||||||
if (SettingsStore.getValue("feature_sliding_sync")) {
|
if (SettingsStore.getValue("feature_sliding_sync")) {
|
||||||
const proxyUrl = SettingsStore.getValue("feature_sliding_sync_proxy_url");
|
const proxyUrl = SettingsStore.getValue("feature_sliding_sync_proxy_url");
|
||||||
|
|
|
@ -229,11 +229,7 @@ export async function fetchInitialEvent(
|
||||||
initialEvent = null;
|
initialEvent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (client.supportsThreads() && initialEvent?.isRelation(THREAD_RELATION_TYPE.name) && !initialEvent.getThread()) {
|
||||||
client.supportsExperimentalThreads() &&
|
|
||||||
initialEvent?.isRelation(THREAD_RELATION_TYPE.name) &&
|
|
||||||
!initialEvent.getThread()
|
|
||||||
) {
|
|
||||||
const threadId = initialEvent.threadRootId;
|
const threadId = initialEvent.threadRootId;
|
||||||
const room = client.getRoom(roomId);
|
const room = client.getRoom(roomId);
|
||||||
const mapper = client.getEventMapper();
|
const mapper = client.getEventMapper();
|
||||||
|
|
|
@ -109,7 +109,7 @@ describe("Notifier", () => {
|
||||||
decryptEventIfNeeded: jest.fn(),
|
decryptEventIfNeeded: jest.fn(),
|
||||||
getRoom: jest.fn(),
|
getRoom: jest.fn(),
|
||||||
getPushActionsForEvent: jest.fn(),
|
getPushActionsForEvent: jest.fn(),
|
||||||
supportsExperimentalThreads: jest.fn().mockReturnValue(false),
|
supportsThreads: jest.fn().mockReturnValue(false),
|
||||||
});
|
});
|
||||||
|
|
||||||
mockClient.pushRules = {
|
mockClient.pushRules = {
|
||||||
|
|
|
@ -124,7 +124,7 @@ describe("Unread", () => {
|
||||||
const myId = client.getUserId()!;
|
const myId = client.getUserId()!;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
client.supportsExperimentalThreads = () => true;
|
client.supportsThreads = () => true;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -48,7 +48,7 @@ describe("<RoomSearchView/>", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
stubClient();
|
stubClient();
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
client.supportsExperimentalThreads = jest.fn().mockReturnValue(true);
|
client.supportsThreads = jest.fn().mockReturnValue(true);
|
||||||
room = new Room("!room:server", client, client.getUserId());
|
room = new Room("!room:server", client, client.getUserId());
|
||||||
mocked(client.getRoom).mockReturnValue(room);
|
mocked(client.getRoom).mockReturnValue(room);
|
||||||
permalinkCreator = new RoomPermalinkCreator(room, room.roomId);
|
permalinkCreator = new RoomPermalinkCreator(room, room.roomId);
|
||||||
|
|
|
@ -161,7 +161,7 @@ describe("ThreadPanel", () => {
|
||||||
Thread.setServerSideSupport(FeatureSupport.Stable);
|
Thread.setServerSideSupport(FeatureSupport.Stable);
|
||||||
Thread.setServerSideListSupport(FeatureSupport.Stable);
|
Thread.setServerSideListSupport(FeatureSupport.Stable);
|
||||||
Thread.setServerSideFwdPaginationSupport(FeatureSupport.Stable);
|
Thread.setServerSideFwdPaginationSupport(FeatureSupport.Stable);
|
||||||
jest.spyOn(mockClient, "supportsExperimentalThreads").mockReturnValue(true);
|
jest.spyOn(mockClient, "supportsThreads").mockReturnValue(true);
|
||||||
|
|
||||||
room = new Room(ROOM_ID, mockClient, mockClient.getUserId() ?? "", {
|
room = new Room(ROOM_ID, mockClient, mockClient.getUserId() ?? "", {
|
||||||
pendingEventOrdering: PendingEventOrdering.Detached,
|
pendingEventOrdering: PendingEventOrdering.Detached,
|
||||||
|
|
|
@ -117,7 +117,7 @@ describe("ThreadView", () => {
|
||||||
stubClient();
|
stubClient();
|
||||||
mockPlatformPeg();
|
mockPlatformPeg();
|
||||||
mockClient = mocked(MatrixClientPeg.get());
|
mockClient = mocked(MatrixClientPeg.get());
|
||||||
jest.spyOn(mockClient, "supportsExperimentalThreads").mockReturnValue(true);
|
jest.spyOn(mockClient, "supportsThreads").mockReturnValue(true);
|
||||||
|
|
||||||
room = new Room(ROOM_ID, mockClient, mockClient.getUserId() ?? "", {
|
room = new Room(ROOM_ID, mockClient, mockClient.getUserId() ?? "", {
|
||||||
pendingEventOrdering: PendingEventOrdering.Detached,
|
pendingEventOrdering: PendingEventOrdering.Detached,
|
||||||
|
|
|
@ -362,7 +362,7 @@ describe("TimelinePanel", () => {
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
|
|
||||||
Thread.hasServerSideSupport = FeatureSupport.Stable;
|
Thread.hasServerSideSupport = FeatureSupport.Stable;
|
||||||
client.supportsExperimentalThreads = () => true;
|
client.supportsThreads = () => true;
|
||||||
const getValueCopy = SettingsStore.getValue;
|
const getValueCopy = SettingsStore.getValue;
|
||||||
SettingsStore.getValue = jest.fn().mockImplementation((name: string) => {
|
SettingsStore.getValue = jest.fn().mockImplementation((name: string) => {
|
||||||
if (name === "feature_threadenabled") return true;
|
if (name === "feature_threadenabled") return true;
|
||||||
|
@ -524,7 +524,7 @@ describe("TimelinePanel", () => {
|
||||||
|
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
client.isRoomEncrypted = () => true;
|
client.isRoomEncrypted = () => true;
|
||||||
client.supportsExperimentalThreads = () => true;
|
client.supportsThreads = () => true;
|
||||||
client.decryptEventIfNeeded = () => Promise.resolve();
|
client.decryptEventIfNeeded = () => Promise.resolve();
|
||||||
const authorId = client.getUserId()!;
|
const authorId = client.getUserId()!;
|
||||||
const room = new Room("roomId", client, authorId, {
|
const room = new Room("roomId", client, authorId, {
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe("RoomHeaderButtons-test.tsx", function () {
|
||||||
|
|
||||||
stubClient();
|
stubClient();
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
client.supportsExperimentalThreads = () => true;
|
client.supportsThreads = () => true;
|
||||||
room = new Room(ROOM_ID, client, client.getUserId() ?? "", {
|
room = new Room(ROOM_ID, client, client.getUserId() ?? "", {
|
||||||
pendingEventOrdering: PendingEventOrdering.Detached,
|
pendingEventOrdering: PendingEventOrdering.Detached,
|
||||||
});
|
});
|
||||||
|
|
|
@ -92,7 +92,7 @@ describe("EventTile", () => {
|
||||||
|
|
||||||
describe("EventTile thread summary", () => {
|
describe("EventTile thread summary", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.spyOn(client, "supportsExperimentalThreads").mockReturnValue(true);
|
jest.spyOn(client, "supportsThreads").mockReturnValue(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("removes the thread summary when thread is deleted", async () => {
|
it("removes the thread summary when thread is deleted", async () => {
|
||||||
|
|
|
@ -48,7 +48,7 @@ describe("UnreadNotificationBadge", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
client.supportsExperimentalThreads = () => true;
|
client.supportsThreads = () => true;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -225,7 +225,7 @@ describe("<Notifications />", () => {
|
||||||
}),
|
}),
|
||||||
setAccountData: jest.fn(),
|
setAccountData: jest.fn(),
|
||||||
sendReadReceipt: jest.fn(),
|
sendReadReceipt: jest.fn(),
|
||||||
supportsExperimentalThreads: jest.fn().mockReturnValue(true),
|
supportsThreads: jest.fn().mockReturnValue(true),
|
||||||
});
|
});
|
||||||
mockClient.getPushRules.mockResolvedValue(pushRules);
|
mockClient.getPushRules.mockResolvedValue(pushRules);
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ describe("RoomViewStore", function () {
|
||||||
getSafeUserId: jest.fn().mockReturnValue(userId),
|
getSafeUserId: jest.fn().mockReturnValue(userId),
|
||||||
getDeviceId: jest.fn().mockReturnValue("ABC123"),
|
getDeviceId: jest.fn().mockReturnValue("ABC123"),
|
||||||
sendStateEvent: jest.fn().mockResolvedValue({}),
|
sendStateEvent: jest.fn().mockResolvedValue({}),
|
||||||
supportsExperimentalThreads: jest.fn(),
|
supportsThreads: jest.fn(),
|
||||||
});
|
});
|
||||||
const room = new Room(roomId, mockClient, userId);
|
const room = new Room(roomId, mockClient, userId);
|
||||||
const room2 = new Room(roomId2, mockClient, userId);
|
const room2 = new Room(roomId2, mockClient, userId);
|
||||||
|
|
|
@ -166,7 +166,7 @@ export function createTestClient(): MatrixClient {
|
||||||
decryptEventIfNeeded: () => Promise.resolve(),
|
decryptEventIfNeeded: () => Promise.resolve(),
|
||||||
isUserIgnored: jest.fn().mockReturnValue(false),
|
isUserIgnored: jest.fn().mockReturnValue(false),
|
||||||
getCapabilities: jest.fn().mockResolvedValue({}),
|
getCapabilities: jest.fn().mockResolvedValue({}),
|
||||||
supportsExperimentalThreads: () => false,
|
supportsThreads: () => false,
|
||||||
getRoomUpgradeHistory: jest.fn().mockReturnValue([]),
|
getRoomUpgradeHistory: jest.fn().mockReturnValue([]),
|
||||||
getOpenIdToken: jest.fn().mockResolvedValue(undefined),
|
getOpenIdToken: jest.fn().mockResolvedValue(undefined),
|
||||||
registerWithIdentityServer: jest.fn().mockResolvedValue({}),
|
registerWithIdentityServer: jest.fn().mockResolvedValue({}),
|
||||||
|
|
|
@ -436,7 +436,7 @@ describe("EventUtils", () => {
|
||||||
pendingEventOrdering: PendingEventOrdering.Detached,
|
pendingEventOrdering: PendingEventOrdering.Detached,
|
||||||
});
|
});
|
||||||
|
|
||||||
jest.spyOn(client, "supportsExperimentalThreads").mockReturnValue(true);
|
jest.spyOn(client, "supportsThreads").mockReturnValue(true);
|
||||||
jest.spyOn(client, "getRoom").mockReturnValue(room);
|
jest.spyOn(client, "getRoom").mockReturnValue(room);
|
||||||
jest.spyOn(client, "fetchRoomEvent").mockImplementation(async (roomId, eventId) => {
|
jest.spyOn(client, "fetchRoomEvent").mockImplementation(async (roomId, eventId) => {
|
||||||
return events[eventId] ?? Promise.reject();
|
return events[eventId] ?? Promise.reject();
|
||||||
|
|
Loading…
Reference in a new issue