Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit d98a7f5

Browse files
committed
Merge branch 'develop' into florianduros/rip-out-legacy-crypto/remove-feature-dehydration
2 parents 1d3ca7a + 4e5cf1b commit d98a7f5

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

Diff for: res/css/structures/auth/_MobileRegistration.pcss

+3
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ Please see LICENSE files in the repository root for full details.
77

88
.mx_MobileRegister_body {
99
padding: 32px;
10+
height: 100vh;
11+
overflow-y: auto;
12+
box-sizing: border-box;
1013
}

Diff for: src/components/views/rooms/EventTile.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ class E2ePadlock extends React.Component<IE2ePadlockProps> {
15191519
// https://github.com/element-hq/compound/issues/294
15201520
return (
15211521
<Tooltip label={this.props.title} isTriggerInteractive={true}>
1522-
<div className={classes} tabIndex={0} />
1522+
<div className={classes} tabIndex={0} aria-label={_t("timeline|e2e_state")} />
15231523
</Tooltip>
15241524
);
15251525
}

Diff for: src/i18n/strings/en_EN.json

+1
Original file line numberDiff line numberDiff line change
@@ -3271,6 +3271,7 @@
32713271
"download_action_downloading": "Downloading",
32723272
"download_failed": "Download failed",
32733273
"download_failed_description": "An error occurred while downloading this file",
3274+
"e2e_state": "State of the end-to-end encryption",
32743275
"edits": {
32753276
"tooltip_label": "Edited at %(date)s. Click to view edits.",
32763277
"tooltip_sub": "Click to view edits",

Diff for: src/stores/ReadyWatchingStore.ts

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export abstract class ReadyWatchingStore extends EventEmitter implements IDestro
2929
super();
3030

3131
this.dispatcherRef = this.dispatcher.register(this.onAction);
32+
33+
ReadyWatchingStore.instances.push(this);
3234
}
3335

3436
public get matrixClient(): MatrixClient | null {

Diff for: test/MatrixClientPeg-test.ts

+9-11
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9+
import * as MatrixJs from "matrix-js-sdk/src/matrix";
910
import { logger } from "matrix-js-sdk/src/logger";
10-
import fetchMockJest from "fetch-mock-jest";
1111

1212
import { advanceDateAndTime, stubClient } from "./test-utils";
1313
import { IMatrixClientPeg, MatrixClientPeg as peg } from "../src/MatrixClientPeg";
@@ -19,9 +19,14 @@ jest.useFakeTimers();
1919
const PegClass = Object.getPrototypeOf(peg).constructor;
2020

2121
describe("MatrixClientPeg", () => {
22+
let mockClient: MatrixJs.MatrixClient;
23+
2224
beforeEach(() => {
2325
// stub out Logger.log which gets called a lot and clutters up the test output
2426
jest.spyOn(logger, "log").mockImplementation(() => {});
27+
28+
mockClient = stubClient();
29+
jest.spyOn(MatrixJs, "createClient").mockReturnValue(mockClient);
2530
});
2631

2732
afterEach(() => {
@@ -33,7 +38,6 @@ describe("MatrixClientPeg", () => {
3338
});
3439

3540
it("setJustRegisteredUserId", () => {
36-
stubClient();
3741
(peg as any).matrixClient = peg.get();
3842
peg.setJustRegisteredUserId("@userId:matrix.org");
3943
expect(peg.safeGet().credentials.userId).toBe("@userId:matrix.org");
@@ -52,7 +56,6 @@ describe("MatrixClientPeg", () => {
5256
});
5357

5458
it("setJustRegisteredUserId(null)", () => {
55-
stubClient();
5659
(peg as any).matrixClient = peg.get();
5760
peg.setJustRegisteredUserId(null);
5861
expect(peg.currentUserIsJustRegistered()).toBe(false);
@@ -71,7 +74,6 @@ describe("MatrixClientPeg", () => {
7174
beforeEach(() => {
7275
// instantiate a MatrixClientPegClass instance, with a new MatrixClient
7376
testPeg = new PegClass();
74-
fetchMockJest.get("http://example.com/_matrix/client/versions", {});
7577
testPeg.replaceUsingCreds({
7678
accessToken: "SEKRET",
7779
homeserverUrl: "http://example.com",
@@ -83,24 +85,20 @@ describe("MatrixClientPeg", () => {
8385
it("should initialise the rust crypto library by default", async () => {
8486
const mockSetValue = jest.spyOn(SettingsStore, "setValue").mockResolvedValue(undefined);
8587

86-
const mockInitCrypto = jest.spyOn(testPeg.safeGet(), "initCrypto").mockResolvedValue(undefined);
87-
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
88-
8988
const cryptoStoreKey = new Uint8Array([1, 2, 3, 4]);
9089
await testPeg.start({ rustCryptoStoreKey: cryptoStoreKey });
91-
expect(mockInitCrypto).not.toHaveBeenCalled();
92-
expect(mockInitRustCrypto).toHaveBeenCalledWith({ storageKey: cryptoStoreKey });
90+
expect(mockClient.initCrypto).not.toHaveBeenCalled();
91+
expect(mockClient.initRustCrypto).toHaveBeenCalledWith({ storageKey: cryptoStoreKey });
9392

9493
// we should have stashed the setting in the settings store
9594
expect(mockSetValue).toHaveBeenCalledWith("feature_rust_crypto", null, SettingLevel.DEVICE, true);
9695
});
9796

9897
it("Should migrate existing login", async () => {
9998
const mockSetValue = jest.spyOn(SettingsStore, "setValue").mockResolvedValue(undefined);
100-
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
10199

102100
await testPeg.start();
103-
expect(mockInitRustCrypto).toHaveBeenCalledTimes(1);
101+
expect(mockClient.initRustCrypto).toHaveBeenCalledTimes(1);
104102

105103
// we should have stashed the setting in the settings store
106104
expect(mockSetValue).toHaveBeenCalledWith("feature_rust_crypto", null, SettingLevel.DEVICE, true);

Diff for: test/test-utils/test-utils.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,14 @@ export function createTestClient(): MatrixClient {
8686
let txnId = 1;
8787

8888
const client = {
89+
startClient: jest.fn(),
8990
getHomeserverUrl: jest.fn(),
9091
getIdentityServerUrl: jest.fn(),
9192
getDomain: jest.fn().mockReturnValue("matrix.org"),
9293
getUserId: jest.fn().mockReturnValue("@userId:matrix.org"),
9394
getSafeUserId: jest.fn().mockReturnValue("@userId:matrix.org"),
9495
getUserIdLocalpart: jest.fn().mockResolvedValue("userId"),
95-
getUser: jest.fn().mockReturnValue({ on: jest.fn(), off: jest.fn() }),
96+
getUser: jest.fn().mockReturnValue({ on: jest.fn(), off: jest.fn(), removeListener: jest.fn() }),
9697
getDevice: jest.fn(),
9798
getDeviceId: jest.fn().mockReturnValue("ABCDEFGHI"),
9899
getStoredCrossSigningForUser: jest.fn(),
@@ -133,6 +134,8 @@ export function createTestClient(): MatrixClient {
133134
getVerificationRequestsToDeviceInProgress: jest.fn().mockReturnValue([]),
134135
setDeviceIsolationMode: jest.fn(),
135136
}),
137+
initCrypto: jest.fn(),
138+
initRustCrypto: jest.fn(),
136139

137140
getPushActionsForEvent: jest.fn(),
138141
getRoom: jest.fn().mockImplementation((roomId) => mkStubRoom(roomId, "My room", client)),
@@ -180,6 +183,7 @@ export function createTestClient(): MatrixClient {
180183
getSyncState: jest.fn().mockReturnValue("SYNCING"),
181184
generateClientSecret: () => "t35tcl1Ent5ECr3T",
182185
isGuest: jest.fn().mockReturnValue(false),
186+
setGuest: jest.fn(),
183187
getRoomHierarchy: jest.fn().mockReturnValue({
184188
rooms: [],
185189
}),
@@ -277,6 +281,7 @@ export function createTestClient(): MatrixClient {
277281
isFallbackICEServerAllowed: jest.fn().mockReturnValue(false),
278282
getAuthIssuer: jest.fn(),
279283
getOrCreateFilter: jest.fn(),
284+
setNotifTimelineSet: jest.fn(),
280285
} as unknown as MatrixClient;
281286

282287
client.reEmitter = new ReEmitter(client);

0 commit comments

Comments
 (0)