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

Commit 3a04603

Browse files
authored
Merge branch 'develop' into florianduros/rip-out-legacy-crypto/remove-matrixclient-crypto-references
2 parents ef306d2 + 771d4a8 commit 3a04603

File tree

63 files changed

+621
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+621
-176
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"dependencies": {
7474
"@babel/runtime": "^7.12.5",
7575
"@matrix-org/analytics-events": "^0.26.0",
76-
"@matrix-org/emojibase-bindings": "^1.1.2",
76+
"@matrix-org/emojibase-bindings": "^1.3.3",
7777
"@vector-im/matrix-wysiwyg": "2.37.13",
7878
"@matrix-org/react-sdk-module-api": "^2.4.0",
7979
"@matrix-org/spec": "^1.7.0",

playwright/e2e/crypto/crypto.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const testMessages = async (page: Page, bob: Bot, bobRoomId: string) => {
4343
};
4444

4545
const bobJoin = async (page: Page, bob: Bot) => {
46+
// Wait for Bob to get the invite
4647
await bob.evaluate(async (cli) => {
4748
const bobRooms = cli.getRooms();
4849
if (!bobRooms.length) {
@@ -55,9 +56,13 @@ const bobJoin = async (page: Page, bob: Bot) => {
5556
});
5657
}
5758
});
58-
const roomId = await bob.joinRoomByName("Alice");
5959

60+
const roomId = await bob.joinRoomByName("Alice");
6061
await expect(page.getByText("Bob joined the room")).toBeVisible();
62+
63+
// Even though Alice has seen Bob's join event, Bob may not have done so yet. Wait for the sync to arrive.
64+
await bob.awaitRoomMembership(roomId);
65+
6166
return roomId;
6267
};
6368

playwright/e2e/crypto/event-shields.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test.describe("Cryptography", function () {
3333
await app.client.bootstrapCrossSigning(aliceCredentials);
3434
await autoJoin(bob);
3535

36-
// create an encrypted room
36+
// create an encrypted room, and wait for Bob to join it.
3737
testRoomId = await createSharedRoomWithUser(app, bob.credentials.userId, {
3838
name: "TestRoom",
3939
initial_state: [
@@ -46,6 +46,9 @@ test.describe("Cryptography", function () {
4646
},
4747
],
4848
});
49+
50+
// Even though Alice has seen Bob's join event, Bob may not have done so yet. Wait for the sync to arrive.
51+
await bob.awaitRoomMembership(testRoomId);
4952
});
5053

5154
test("should show the correct shield on e2e events", async ({
@@ -287,9 +290,9 @@ test.describe("Cryptography", function () {
287290
// Let our app start syncing again
288291
await app.client.network.goOnline();
289292

290-
// Wait for the messages to arrive
293+
// Wait for the messages to arrive. It can take quite a while for the sync to wake up.
291294
const last = page.locator(".mx_EventTile_last");
292-
await expect(last).toContainText("test encrypted from unverified");
295+
await expect(last).toContainText("test encrypted from unverified", { timeout: 20000 });
293296
const lastE2eIcon = last.locator(".mx_EventTile_e2eIcon");
294297
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
295298
await lastE2eIcon.focus();

playwright/e2e/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ import { Client } from "../pages/client";
2020
* @param client Client instance that can be user or bot
2121
* @param roomId room id to find room and check
2222
* @param predicate defines condition that is used to check the room state
23+
*
24+
* FIXME this does not do what it is supposed to do, and I think it is unfixable.
25+
* `page.exposeFunction` adds a function which returns a Promise. `window[predicateId](room)` therefore
26+
* always returns a truthy value (a Promise). But even if you fix that: as far as I can tell, the Room is
27+
* just passed to the callback function as a JSON blob: you cannot actually call any methods on it, so the
28+
* callback is useless.
29+
*
30+
* @deprecated This function is broken.
2331
*/
2432
export async function waitForRoom(
2533
page: Page,

playwright/pages/client.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,54 @@ export class Client {
289289
await client.evaluate((client, { roomId, userId }) => client.unban(roomId, userId), { roomId, userId });
290290
}
291291

292+
/**
293+
* Wait for the client to have specific membership of a given room
294+
*
295+
* This is often useful after joining a room, when we need to wait for the sync loop to catch up.
296+
*
297+
* Times out with an error after 1 second.
298+
*
299+
* @param roomId - ID of the room to check
300+
* @param membership - required membership.
301+
*/
302+
public async awaitRoomMembership(roomId: string, membership: string = "join") {
303+
await this.evaluate(
304+
(cli: MatrixClient, { roomId, membership }) => {
305+
const isReady = () => {
306+
// Fetch the room on each check, because we get a different instance before and after the join arrives.
307+
const room = cli.getRoom(roomId);
308+
const myMembership = room?.getMyMembership();
309+
// @ts-ignore access to private field "logger"
310+
cli.logger.info(`waiting for room ${roomId}: membership now ${myMembership}`);
311+
return myMembership === membership;
312+
};
313+
if (isReady()) return;
314+
315+
const timeoutPromise = new Promise((resolve) => setTimeout(resolve, 1000)).then(() => {
316+
const room = cli.getRoom(roomId);
317+
const myMembership = room?.getMyMembership();
318+
throw new Error(
319+
`Timeout waiting for room ${roomId} membership (now '${myMembership}', wanted '${membership}')`,
320+
);
321+
});
322+
323+
const readyPromise = new Promise<void>((resolve) => {
324+
async function onEvent() {
325+
if (isReady()) {
326+
cli.removeListener(window.matrixcs.ClientEvent.Event, onEvent);
327+
resolve();
328+
}
329+
}
330+
331+
cli.on(window.matrixcs.ClientEvent.Event, onEvent);
332+
});
333+
334+
return Promise.race([timeoutPromise, readyPromise]);
335+
},
336+
{ roomId, membership },
337+
);
338+
}
339+
292340
/**
293341
* @param {MatrixEvent} event
294342
* @param {ReceiptType} receiptType
Loading

res/css/structures/auth/_MobileRegistration.pcss

Lines changed: 3 additions & 0 deletions
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
}

res/css/views/audio_messages/_PlayPauseButton.pcss

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,21 @@ Please see LICENSE files in the repository root for full details.
2121
background-color: $secondary-content;
2222
mask-repeat: no-repeat;
2323
mask-size: contain;
24+
top: 6px; /* center */
25+
left: 6px; /* center */
26+
width: 20px;
27+
height: 20px;
2428
}
2529

2630
&.mx_PlayPauseButton_disabled::before {
2731
opacity: 0.5;
2832
}
2933

3034
&.mx_PlayPauseButton_play::before {
31-
width: 13px;
32-
height: 16px;
33-
top: 8px; /* center */
34-
left: 12px; /* center */
35-
mask-image: url("$(res)/img/element-icons/play.svg");
35+
mask-image: url("@vector-im/compound-design-tokens/icons/play-solid.svg");
3636
}
3737

3838
&.mx_PlayPauseButton_pause::before {
39-
width: 10px;
40-
height: 12px;
41-
top: 10px; /* center */
42-
left: 11px; /* center */
43-
mask-image: url("$(res)/img/element-icons/pause.svg");
39+
mask-image: url("@vector-im/compound-design-tokens/icons/pause-solid.svg");
4440
}
4541
}

res/css/views/messages/_LegacyCallEvent.pcss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Please see LICENSE files in the repository root for full details.
7575
&.mx_LegacyCallEvent_rejected,
7676
&.mx_LegacyCallEvent_noAnswer {
7777
.mx_LegacyCallEvent_type_icon::before {
78-
mask-image: url("$(res)/img/voip/declined-video.svg");
78+
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-declined-solid.svg");
7979
}
8080
}
8181
}
@@ -89,7 +89,7 @@ Please see LICENSE files in the repository root for full details.
8989

9090
&.mx_LegacyCallEvent_video {
9191
.mx_LegacyCallEvent_type_icon::before {
92-
mask-image: url("$(res)/img/voip/missed-video.svg");
92+
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-missed-solid.svg");
9393
}
9494
}
9595
}

res/css/views/rooms/_MessageComposer.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ Please see LICENSE files in the repository root for full details.
253253
}
254254

255255
.mx_MessageComposer_voiceMessage::before {
256-
mask-image: url("$(res)/img/element-icons/mic.svg");
256+
mask-image: url("@vector-im/compound-design-tokens/icons/mic-on-solid.svg");
257257
}
258258

259259
.mx_MessageComposer_voiceBroadcast::before {

res/css/views/rooms/_ReplyTile.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Please see LICENSE files in the repository root for full details.
1212
font: var(--cpd-font-body-md-regular);
1313

1414
&.mx_ReplyTile_audio .mx_MFileBody_info_icon::before {
15-
mask-image: url("$(res)/img/element-icons/speaker.svg");
15+
mask-image: url("@vector-im/compound-design-tokens/icons/volume-on-solid.svg");
1616
}
1717

1818
&.mx_ReplyTile_video .mx_MFileBody_info_icon::before {

res/css/views/voip/LegacyCallView/_LegacyCallViewButtons.pcss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@ Please see LICENSE files in the repository root for full details.
8787

8888
&.mx_LegacyCallViewButtons_button_mic::before {
8989
height: 20px;
90-
mask-image: url("$(res)/img/element-icons/mic.svg");
90+
mask-image: url("@vector-im/compound-design-tokens/icons/mic-on-solid.svg");
9191
width: 20px;
9292
}
9393

9494
&.mx_LegacyCallViewButtons_button_vid::before {
95-
mask-image: url("$(res)/img/voip/call-view/cam-on.svg");
95+
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-solid.svg");
9696
}
9797

9898
&.mx_LegacyCallViewButtons_button_screensharing {
9999
background-color: $accent;
100100

101101
&::before {
102-
mask-image: url("$(res)/img/voip/call-view/screensharing.svg");
102+
mask-image: url("@vector-im/compound-design-tokens/icons/share-screen-solid.svg");
103103
background-color: white; /* Same on both themes */
104104
}
105105
}
@@ -118,19 +118,19 @@ Please see LICENSE files in the repository root for full details.
118118

119119
&.mx_LegacyCallViewButtons_button_mic::before {
120120
height: 20px;
121-
mask-image: url("$(res)/img/element-icons/Mic-off.svg");
121+
mask-image: url("@vector-im/compound-design-tokens/icons/mic-off-solid.svg");
122122
width: 20px;
123123
}
124124

125125
&.mx_LegacyCallViewButtons_button_vid::before {
126-
mask-image: url("$(res)/img/voip/call-view/cam-off.svg");
126+
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-off-solid.svg");
127127
}
128128

129129
&.mx_LegacyCallViewButtons_button_screensharing {
130130
background-color: $call-view-button-on-background;
131131

132132
&::before {
133-
mask-image: url("$(res)/img/voip/call-view/screensharing.svg");
133+
mask-image: url("@vector-im/compound-design-tokens/icons/share-screen-solid.svg");
134134
background-color: $call-view-button-on-foreground;
135135
}
136136
}

res/css/views/voip/_CallView.pcss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ Please see LICENSE files in the repository root for full details.
123123
}
124124

125125
&.mx_CallView_deviceButton_audio::before {
126-
mask-image: url("$(res)/img/element-icons/mic.svg");
126+
mask-image: url("@vector-im/compound-design-tokens/icons/mic-on-solid.svg");
127127
mask-size: 14px;
128128
}
129129

130130
&.mx_CallView_deviceButton_video::before {
131-
mask-image: url("$(res)/img/voip/call-view/cam-on.svg");
131+
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-solid.svg");
132132
}
133133
}
134134

@@ -168,12 +168,12 @@ Please see LICENSE files in the repository root for full details.
168168

169169
.mx_CallView_deviceButton {
170170
&.mx_CallView_deviceButton_audio::before {
171-
mask-image: url("$(res)/img/element-icons/Mic-off.svg");
171+
mask-image: url("@vector-im/compound-design-tokens/icons/mic-off-solid.svg");
172172
mask-size: 18px;
173173
}
174174

175175
&.mx_CallView_deviceButton_video::before {
176-
mask-image: url("$(res)/img/voip/call-view/cam-off.svg");
176+
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-off-solid.svg");
177177
}
178178
}
179179
}

res/css/views/voip/_VideoFeed.pcss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ Please see LICENSE files in the repository root for full details.
7272
}
7373

7474
&.mx_VideoFeed_mic_muted::before {
75-
mask-image: url("$(res)/img/element-icons/Mic-off.svg");
75+
mask-image: url("@vector-im/compound-design-tokens/icons/mic-off-solid.svg");
7676
}
7777

7878
&.mx_VideoFeed_mic_unmuted::before {
79-
mask-image: url("$(res)/img/element-icons/mic.svg");
79+
mask-image: url("@vector-im/compound-design-tokens/icons/mic-on-solid.svg");
8080
}
8181
}
8282
}

res/img/compound/mic-16px.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

res/img/compound/pause-12.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

res/img/compound/play-16.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

res/img/element-icons/Mic-off.svg

Lines changed: 0 additions & 5 deletions
This file was deleted.

res/img/element-icons/mic.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

res/img/element-icons/pause.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

res/img/element-icons/play.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

res/img/element-icons/speaker.svg

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)