Skip to content

Commit 74ee067

Browse files
committed
Check room encryption earlier
1 parent af3a977 commit 74ee067

File tree

2 files changed

+29
-199
lines changed

2 files changed

+29
-199
lines changed

src/components/structures/RoomView.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
577577
activeCall: roomId ? CallStore.instance.getActiveCall(roomId) : null,
578578
promptAskToJoin: this.context.roomViewStore.promptAskToJoin(),
579579
viewRoomOpts: this.context.roomViewStore.getViewRoomOpts(),
580+
isRoomEncrypted: roomId ? await this.getIsRoomEncrypted(roomId) : null,
580581
};
581582

582583
if (
@@ -863,7 +864,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
863864
return isManuallyShown && widgets.length > 0;
864865
}
865866

866-
public async componentDidMount(): Promise<void> {
867+
public componentDidMount(): void {
867868
this.unmounted = false;
868869

869870
this.dispatcherRef = defaultDispatcher.register(this.onAction);

test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap

+27-198
Original file line numberDiff line numberDiff line change
@@ -1281,207 +1281,36 @@ exports[`RoomView should not display the timeline when the room encryption is lo
12811281
<div
12821282
class="mx_RoomView"
12831283
>
1284-
<canvas
1285-
aria-hidden="true"
1286-
height="768"
1287-
style="display: block; z-index: 999999; pointer-events: none; position: fixed; top: 0px; right: 0px;"
1288-
width="0"
1289-
/>
12901284
<div
1291-
class="mx_MainSplit"
1285+
class="mx_RoomPreviewBar mx_RoomPreviewBar_Loading mx_RoomPreviewBar_dialog"
1286+
role="complementary"
12921287
>
12931288
<div
1294-
class="mx_RoomView_body mx_MainSplit_timeline"
1295-
data-layout="group"
1289+
class="mx_RoomPreviewBar_message"
12961290
>
1297-
<header
1298-
class="mx_Flex mx_RoomHeader light-panel"
1299-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-3x);"
1291+
<h3
1292+
class="mx_RoomPreviewBar_spinnerTitle"
13001293
>
1301-
<button
1302-
aria-label="Open room settings"
1303-
aria-live="off"
1304-
class="_avatar_mcap2_17 mx_BaseAvatar _avatar-imageless_mcap2_61"
1305-
data-color="1"
1306-
data-testid="avatar-img"
1307-
data-type="round"
1308-
role="button"
1309-
style="--cpd-avatar-size: 40px;"
1310-
tabindex="-1"
1311-
>
1312-
!
1313-
</button>
1314-
<button
1315-
aria-label="Room info"
1316-
class="mx_RoomHeader_infoWrapper"
1317-
tabindex="0"
1318-
>
1319-
<div
1320-
class="mx_Box mx_RoomHeader_info mx_Box--flex"
1321-
style="--mx-box-flex: 1;"
1322-
>
1323-
<div
1324-
aria-level="1"
1325-
class="_typography_yh5dq_162 _font-body-lg-semibold_yh5dq_83 mx_RoomHeader_heading"
1326-
dir="auto"
1327-
role="heading"
1328-
>
1329-
<span
1330-
class="mx_RoomHeader_truncated mx_lineClamp"
1331-
>
1332-
!5:example.org
1333-
</span>
1334-
</div>
1335-
</div>
1336-
</button>
13371294
<div
1338-
class="mx_Flex"
1339-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-2x);"
1340-
>
1341-
<button
1342-
aria-disabled="true"
1343-
aria-label="There's no one here to call"
1344-
class="_icon-button_bh2qc_17"
1345-
role="button"
1346-
style="--cpd-icon-button-size: 32px;"
1347-
tabindex="0"
1348-
>
1349-
<div
1350-
class="_indicator-icon_133tf_26"
1351-
style="--cpd-icon-button-size: 100%; --cpd-color-icon-tertiary: var(--cpd-color-icon-disabled);"
1352-
>
1353-
<svg
1354-
aria-labelledby=":r2c:"
1355-
fill="currentColor"
1356-
height="1em"
1357-
viewBox="0 0 24 24"
1358-
width="1em"
1359-
xmlns="http://www.w3.org/2000/svg"
1360-
>
1361-
<path
1362-
d="M6 4h10a2 2 0 0 1 2 2v4.286l3.35-2.871a1 1 0 0 1 1.65.76v7.65a1 1 0 0 1-1.65.76L18 13.715V18a2 2 0 0 1-2 2H6a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4Z"
1363-
/>
1364-
</svg>
1365-
</div>
1366-
</button>
1367-
<button
1368-
aria-disabled="true"
1369-
aria-label="There's no one here to call"
1370-
aria-labelledby=":r2h:"
1371-
class="_icon-button_bh2qc_17"
1372-
role="button"
1373-
style="--cpd-icon-button-size: 32px;"
1374-
tabindex="0"
1375-
>
1376-
<div
1377-
class="_indicator-icon_133tf_26"
1378-
style="--cpd-icon-button-size: 100%; --cpd-color-icon-tertiary: var(--cpd-color-icon-disabled);"
1379-
>
1380-
<svg
1381-
fill="currentColor"
1382-
height="1em"
1383-
viewBox="0 0 24 24"
1384-
width="1em"
1385-
xmlns="http://www.w3.org/2000/svg"
1386-
>
1387-
<path
1388-
d="m20.958 16.374.039 3.527c0 .285-.11.537-.33.756-.22.22-.472.33-.756.33a15.97 15.97 0 0 1-6.57-1.105 16.223 16.223 0 0 1-5.563-3.663 16.084 16.084 0 0 1-3.653-5.573 16.313 16.313 0 0 1-1.115-6.56c0-.285.11-.537.33-.757.22-.22.471-.329.755-.329l3.528.039a1.069 1.069 0 0 1 1.085.93l.543 3.954c.026.181.013.349-.039.504a1.088 1.088 0 0 1-.271.426l-1.64 1.64c.337.672.721 1.308 1.154 1.909.433.6 1.444 1.696 1.444 1.696s1.095 1.01 1.696 1.444c.6.433 1.237.817 1.909 1.153l1.64-1.64a1.08 1.08 0 0 1 .426-.27c.155-.052.323-.065.504-.04l3.954.543a1.069 1.069 0 0 1 .93 1.085Z"
1389-
/>
1390-
</svg>
1391-
</div>
1392-
</button>
1393-
<button
1394-
aria-label="Room info"
1395-
aria-labelledby=":r2m:"
1396-
class="_icon-button_bh2qc_17"
1397-
role="button"
1398-
style="--cpd-icon-button-size: 32px;"
1399-
tabindex="0"
1400-
>
1401-
<div
1402-
class="_indicator-icon_133tf_26"
1403-
style="--cpd-icon-button-size: 100%;"
1404-
>
1405-
<svg
1406-
fill="currentColor"
1407-
height="1em"
1408-
viewBox="0 0 24 24"
1409-
width="1em"
1410-
xmlns="http://www.w3.org/2000/svg"
1411-
>
1412-
<path
1413-
d="M12 17a.97.97 0 0 0 .713-.288A.968.968 0 0 0 13 16v-4a.968.968 0 0 0-.287-.713A.968.968 0 0 0 12 11a.968.968 0 0 0-.713.287A.968.968 0 0 0 11 12v4c0 .283.096.52.287.712.192.192.43.288.713.288Zm0-8c.283 0 .52-.096.713-.287A.967.967 0 0 0 13 8a.967.967 0 0 0-.287-.713A.968.968 0 0 0 12 7a.968.968 0 0 0-.713.287A.967.967 0 0 0 11 8c0 .283.096.52.287.713.192.191.43.287.713.287Zm0 13a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12a9.74 9.74 0 0 1 .788-3.9 10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2a9.74 9.74 0 0 1 3.9.788 10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Z"
1414-
/>
1415-
</svg>
1416-
</div>
1417-
</button>
1418-
<button
1419-
aria-label="Threads"
1420-
aria-labelledby=":r2r:"
1421-
class="_icon-button_bh2qc_17"
1422-
role="button"
1423-
style="--cpd-icon-button-size: 32px;"
1424-
tabindex="0"
1425-
>
1426-
<div
1427-
class="_indicator-icon_133tf_26"
1428-
style="--cpd-icon-button-size: 100%;"
1429-
>
1430-
<svg
1431-
fill="currentColor"
1432-
height="1em"
1433-
viewBox="0 0 24 24"
1434-
width="1em"
1435-
xmlns="http://www.w3.org/2000/svg"
1436-
>
1437-
<path
1438-
d="M4 3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6l-2.293 2.293c-.63.63-1.707.184-1.707-.707V5a2 2 0 0 1 2-2Zm3 7h10a.97.97 0 0 0 .712-.287A.967.967 0 0 0 18 9a.967.967 0 0 0-.288-.713A.968.968 0 0 0 17 8H7a.968.968 0 0 0-.713.287A.968.968 0 0 0 6 9c0 .283.096.52.287.713.192.191.43.287.713.287Zm0 4h6c.283 0 .52-.096.713-.287A.968.968 0 0 0 14 13a.968.968 0 0 0-.287-.713A.968.968 0 0 0 13 12H7a.967.967 0 0 0-.713.287A.968.968 0 0 0 6 13c0 .283.096.52.287.713.192.191.43.287.713.287Z"
1439-
/>
1440-
</svg>
1441-
</div>
1442-
</button>
1443-
</div>
1444-
<div
1445-
class="_typography_yh5dq_162 _font-body-sm-medium_yh5dq_50"
1295+
class="mx_Spinner"
14461296
>
14471297
<div
1448-
aria-label="0 members"
1449-
aria-labelledby=":r30:"
1450-
class="mx_AccessibleButton mx_FacePile"
1451-
role="button"
1452-
tabindex="0"
1453-
>
1454-
<div
1455-
class="_stacked-avatars_mcap2_111"
1456-
/>
1457-
0
1458-
</div>
1459-
</div>
1460-
</header>
1461-
<div
1462-
class="mx_AutoHideScrollbar mx_AuxPanel"
1463-
role="region"
1464-
tabindex="-1"
1465-
>
1466-
<div />
1467-
</div>
1468-
<main
1469-
class="mx_RoomView_timeline mx_RoomView_timeline_rr_enabled"
1470-
/>
1471-
<div
1472-
aria-label="Room status bar"
1473-
class="mx_RoomView_statusArea"
1474-
role="region"
1475-
>
1476-
<div
1477-
class="mx_RoomView_statusAreaBox"
1478-
>
1479-
<div
1480-
class="mx_RoomView_statusAreaBox_line"
1298+
aria-label="Loading…"
1299+
class="mx_Spinner_icon"
1300+
data-testid="spinner"
1301+
role="progressbar"
1302+
style="width: 32px; height: 32px;"
14811303
/>
14821304
</div>
1483-
</div>
1305+
Loading…
1306+
</h3>
14841307
</div>
1308+
<div
1309+
class="mx_RoomPreviewBar_actions"
1310+
/>
1311+
<div
1312+
class="mx_RoomPreviewBar_footer"
1313+
/>
14851314
</div>
14861315
</div>
14871316
</DocumentFragment>
@@ -1513,7 +1342,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
15131342
aria-label="Open room settings"
15141343
aria-live="off"
15151344
class="_avatar_mcap2_17 mx_BaseAvatar _avatar-imageless_mcap2_61"
1516-
data-color="1"
1345+
data-color="2"
15171346
data-testid="avatar-img"
15181347
data-type="round"
15191348
role="button"
@@ -1540,7 +1369,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
15401369
<span
15411370
class="mx_RoomHeader_truncated mx_lineClamp"
15421371
>
1543-
!5:example.org
1372+
!0:example.org
15441373
</span>
15451374
</div>
15461375
</div>
@@ -1562,7 +1391,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
15621391
style="--cpd-icon-button-size: 100%; --cpd-color-icon-tertiary: var(--cpd-color-icon-disabled);"
15631392
>
15641393
<svg
1565-
aria-labelledby=":r2c:"
1394+
aria-labelledby=":r0:"
15661395
fill="currentColor"
15671396
height="1em"
15681397
viewBox="0 0 24 24"
@@ -1578,7 +1407,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
15781407
<button
15791408
aria-disabled="true"
15801409
aria-label="There's no one here to call"
1581-
aria-labelledby=":r2h:"
1410+
aria-labelledby=":r5:"
15821411
class="_icon-button_bh2qc_17"
15831412
role="button"
15841413
style="--cpd-icon-button-size: 32px;"
@@ -1603,7 +1432,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
16031432
</button>
16041433
<button
16051434
aria-label="Room info"
1606-
aria-labelledby=":r2m:"
1435+
aria-labelledby=":ra:"
16071436
class="_icon-button_bh2qc_17"
16081437
role="button"
16091438
style="--cpd-icon-button-size: 32px;"
@@ -1628,7 +1457,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
16281457
</button>
16291458
<button
16301459
aria-label="Threads"
1631-
aria-labelledby=":r2r:"
1460+
aria-labelledby=":rf:"
16321461
class="_icon-button_bh2qc_17"
16331462
role="button"
16341463
style="--cpd-icon-button-size: 32px;"
@@ -1657,7 +1486,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
16571486
>
16581487
<div
16591488
aria-label="0 members"
1660-
aria-labelledby=":r30:"
1489+
aria-labelledby=":rk:"
16611490
class="mx_AccessibleButton mx_FacePile"
16621491
role="button"
16631492
tabindex="0"
@@ -1725,7 +1554,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
17251554
tabindex="0"
17261555
>
17271556
<div
1728-
aria-labelledby=":r3e:"
1557+
aria-labelledby=":rt:"
17291558
class="mx_E2EIcon mx_E2EIcon_verified mx_MessageComposer_e2eIcon"
17301559
/>
17311560
</span>

0 commit comments

Comments
 (0)