Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial MSC3083 + MSC3244 support #6212

Merged
merged 40 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
bf66a72
Move JoinRule, GuestAccess, HistoryVisibility enums into the js-sdk
t3chguy Jun 18, 2021
56fe7f8
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jun 18, 2021
18cafeb
Add ability to disable entire StyledRadioGroup
t3chguy Jun 18, 2021
e508ff0
Clean up typing to Security Room Settings
t3chguy Jun 18, 2021
566b8af
Initial support for MSC3083 via MSC3244
t3chguy Jun 18, 2021
d0dc5cf
Update early MSC3083 support
t3chguy Jun 22, 2021
88cd5ae
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jun 29, 2021
4c42313
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 1, 2021
fb149c4
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 2, 2021
e8f0412
Add way to manage Restricted join rule in Room Settings
t3chguy Jul 2, 2021
912e192
Tweak behaviour of setting restricted join rule
t3chguy Jul 2, 2021
89949bd
Add new in the spaces beta toast & explanatory modal
t3chguy Jul 2, 2021
1b25ab9
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 5, 2021
44bbf60
Convert Dropdown to Typescript
t3chguy Jul 6, 2021
82100df
Bring dropdown styling into closer line with rest of our styling
t3chguy Jul 6, 2021
6923478
Track restricted join rule support in the SpaceStore for sync access
t3chguy Jul 6, 2021
c5ca98a
Iterate SecurityRoomSettingsTab and ManageRestrictedJoinRuleDialog
t3chguy Jul 6, 2021
eb9f4c6
Make CreateRoomDialog capable of creating restricted rooms in spaces
t3chguy Jul 6, 2021
64d1d16
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 6, 2021
3301763
stub getCapabilities in tests
t3chguy Jul 6, 2021
0ca4a95
fix getCapabilities stub
t3chguy Jul 6, 2021
9d8acd1
stub getJoinRule
t3chguy Jul 6, 2021
04c923b
fix tests by including client field on the Room stub and stubbing get…
t3chguy Jul 6, 2021
06284fe
Update e2e tests
t3chguy Jul 6, 2021
d004163
Fix 2 new NPEs
t3chguy Jul 6, 2021
a5cec34
Merge branch 'develop' into t3chguy/fix/17686
germain-gg Jul 6, 2021
894bce7
Update lockfile
germain-gg Jul 6, 2021
f412fb4
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 9, 2021
437d53d
Update space children (best effort) when upgrading a room
t3chguy Jul 9, 2021
6fe00d1
Convert RoomUpgradeDialog to TS
t3chguy Jul 9, 2021
dcb9b9b
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 15, 2021
5986609
i18n
t3chguy Jul 15, 2021
de42a00
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 19, 2021
f2a8859
delint
t3chguy Jul 19, 2021
a58edcb
tweak copy
t3chguy Jul 21, 2021
390b056
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 21, 2021
fd64d37
Add iconography to Create Room Dialog dropdown
t3chguy Jul 21, 2021
d147aaa
delint and fix min-height issue
t3chguy Jul 21, 2021
18bb4bc
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Jul 22, 2021
cd77b9f
merge two opposing if statements
t3chguy Jul 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
@import "./views/dialogs/_IncomingSasDialog.scss";
@import "./views/dialogs/_InviteDialog.scss";
@import "./views/dialogs/_KeyboardShortcutsDialog.scss";
@import "./views/dialogs/_ManageRestrictedJoinRuleDialog.scss";
@import "./views/dialogs/_MessageEditHistoryDialog.scss";
@import "./views/dialogs/_ModalWidgetDialog.scss";
@import "./views/dialogs/_NewSessionReviewDialog.scss";
Expand Down
18 changes: 13 additions & 5 deletions res/css/views/dialogs/_CreateRoomDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ limitations under the License.
.mx_CreateRoomDialog_aliasContainer {
display: flex;
// put margin on container so it can collapse with siblings
margin: 10px 0;
margin: 24px 0 10px;

.mx_RoomAliasField {
margin: 0;
Expand Down Expand Up @@ -101,10 +101,6 @@ limitations under the License.
margin-left: 30px;
}

.mx_CreateRoomDialog_topic {
margin-bottom: 36px;
}

.mx_Dialog_content > .mx_SettingsFlag {
margin-top: 24px;
}
Expand All @@ -113,5 +109,17 @@ limitations under the License.
margin: 0 85px 0 0;
font-size: $font-12px;
}

.mx_Dropdown {
margin-bottom: 8px;
font-weight: normal;
font-family: $font-family;
font-size: $font-14px;
color: $primary-fg-color;

.mx_Dropdown_input {
border: 1px solid $input-border-color;
}
}
}

150 changes: 150 additions & 0 deletions res/css/views/dialogs/_ManageRestrictedJoinRuleDialog.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/*
Copyright 2021 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.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_ManageRestrictedJoinRuleDialog_wrapper {
.mx_Dialog {
display: flex;
flex-direction: column;
}
}

.mx_ManageRestrictedJoinRuleDialog {
width: 480px;
color: $primary-fg-color;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
min-height: 0;
height: 60vh;

.mx_SearchBox {
// To match the space around the title
margin: 0 0 15px 0;
flex-grow: 0;
}

.mx_ManageRestrictedJoinRuleDialog_content {
flex-grow: 1;
}

.mx_ManageRestrictedJoinRuleDialog_noResults {
display: block;
margin-top: 24px;
}

.mx_ManageRestrictedJoinRuleDialog_section {
&:not(:first-child) {
margin-top: 24px;
}

> h3 {
margin: 0;
color: $secondary-fg-color;
font-size: $font-12px;
font-weight: $font-semi-bold;
line-height: $font-15px;
}

.mx_ManageRestrictedJoinRuleDialog_entry {
display: flex;
margin-top: 12px;

> div {
flex-grow: 1;
}

img.mx_RoomAvatar_isSpaceRoom,
.mx_RoomAvatar_isSpaceRoom img {
border-radius: 4px;
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
}

.mx_ManageRestrictedJoinRuleDialog_entry_name {
margin: 0 8px;
font-size: $font-15px;
line-height: 30px;
flex-grow: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

.mx_ManageRestrictedJoinRuleDialog_entry_description {
margin-top: 8px;
font-size: $font-12px;
line-height: $font-15px;
color: $tertiary-fg-color;
}

.mx_Checkbox {
align-items: center;
}
}
}

.mx_ManageRestrictedJoinRuleDialog_section_spaces {
.mx_BaseAvatar {
margin-right: 12px;
}

.mx_BaseAvatar_image {
border-radius: 8px;
}
}

.mx_ManageRestrictedJoinRuleDialog_section_info {
position: relative;
border-radius: 8px;
margin: 12px 0;
padding: 8px 8px 8px 42px;
background-color: $header-panel-bg-color;

font-size: $font-12px;
line-height: $font-15px;
color: $secondary-fg-color;

&::before {
content: '';
position: absolute;
left: 10px;
top: calc(50% - 8px); // vertical centering
height: 16px;
width: 16px;
background-color: $secondary-fg-color;
mask-repeat: no-repeat;
mask-size: contain;
mask-image: url('$(res)/img/element-icons/room/room-summary.svg');
mask-position: center;
}
}

.mx_ManageRestrictedJoinRuleDialog_footer {
margin-top: 20px;

.mx_ManageRestrictedJoinRuleDialog_footer_buttons {
display: flex;
width: max-content;
margin-left: auto;

.mx_AccessibleButton {
display: inline-block;

& + .mx_AccessibleButton {
margin-left: 24px;
}
}
}
}
}
4 changes: 2 additions & 2 deletions res/css/views/elements/_Dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ limitations under the License.
display: flex;
align-items: center;
position: relative;
border-radius: 3px;
border-radius: 4px;
border: 1px solid $strong-input-border-color;
font-size: $font-12px;
user-select: none;
Expand Down Expand Up @@ -109,7 +109,7 @@ input.mx_Dropdown_option:focus {
z-index: 2;
margin: 0;
padding: 0px;
border-radius: 3px;
border-radius: 4px;
border: 1px solid $input-focused-border-color;
background-color: $primary-bg-color;
max-height: 200px;
Expand Down
4 changes: 2 additions & 2 deletions res/css/views/settings/tabs/_SettingsTab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ limitations under the License.
color: $settings-subsection-fg-color;
font-size: $font-14px;
display: block;
margin: 10px 100px 10px 0; // Align with the rest of the view
margin: 10px 80px 10px 0; // Align with the rest of the view
}

.mx_SettingsTab_section {
margin-bottom: 24px;

.mx_SettingsFlag {
margin-right: 100px;
margin-right: 80px;
margin-bottom: 10px;
}

Expand Down
86 changes: 85 additions & 1 deletion res/css/views/settings/tabs/room/_SecurityRoomSettingsTab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,44 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_SecurityRoomSettingsTab {
.mx_SettingsTab_showAdvanced {
padding: 0;
margin-bottom: 16px;
}

.mx_SecurityRoomSettingsTab_spacesWithAccess {
> h4 {
color: $secondary-fg-color;
font-weight: $font-semi-bold;
font-size: $font-12px;
line-height: $font-15px;
text-transform: uppercase;
}

> span {
font-weight: 500;
font-size: $font-14px;
line-height: 32px; // matches height of avatar for v-align
color: $secondary-fg-color;
display: inline-block;

img.mx_RoomAvatar_isSpaceRoom,
.mx_RoomAvatar_isSpaceRoom img {
border-radius: 8px;
}

.mx_BaseAvatar {
margin-right: 8px;
}

& + span {
margin-left: 16px;
}
}
}
}

.mx_SecurityRoomSettingsTab_warning {
display: block;

Expand All @@ -26,5 +64,51 @@ limitations under the License.
}

.mx_SecurityRoomSettingsTab_encryptionSection {
margin-bottom: 25px;
padding-bottom: 24px;
border-bottom: 1px solid $menu-border-color;
margin-bottom: 32px;
}

.mx_SecurityRoomSettingsTab_upgradeRequired {
margin-left: 16px;
padding: 4px 16px;
border: 1px solid $accent-color;
border-radius: 8px;
color: $accent-color;
font-size: $font-12px;
line-height: $font-15px;
}

.mx_SecurityRoomSettingsTab_joinRule {
.mx_RadioButton {
padding-top: 16px;
margin-bottom: 8px;

.mx_RadioButton_content {
margin-left: 14px;
font-weight: $font-semi-bold;
font-size: $font-15px;
line-height: $font-24px;
color: $primary-fg-color;
display: block;
}
}

> span {
display: inline-block;
margin-left: 34px;
margin-bottom: 16px;
font-size: $font-15px;
line-height: $font-24px;
color: $secondary-fg-color;

& + .mx_RadioButton {
border-top: 1px solid $menu-border-color;
}
}

.mx_AccessibleButton_kind_link {
padding: 0;
font-size: inherit;
}
}
49 changes: 3 additions & 46 deletions src/SlashCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { getAddressType } from './UserAddress';
import { abbreviateUrl } from './utils/UrlUtils';
import { getDefaultIdentityServerUrl, useDefaultIdentityServer } from './utils/IdentityServerUtils';
import { isPermalinkHost, parsePermalink } from "./utils/permalinks/Permalinks";
import { inviteUsersToRoom } from "./RoomInvite";
import { WidgetType } from "./widgets/WidgetType";
import { Jitsi } from "./widgets/Jitsi";
import { parseFragment as parseHtml, Element as ChildElement } from "parse5";
Expand All @@ -50,6 +49,7 @@ import { UIFeature } from "./settings/UIFeature";
import { CHAT_EFFECTS } from "./effects";
import CallHandler from "./CallHandler";
import { guessAndSetDMRoom } from "./Rooms";
import { upgradeRoom } from './utils/RoomUpgrade';

// XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816
interface HTMLInputEvent extends Event {
Expand Down Expand Up @@ -276,51 +276,8 @@ export const Commands = [
/*isPriority=*/false, /*isStatic=*/true);

return success(finished.then(async ([resp]) => {
if (!resp.continue) return;

let checkForUpgradeFn;
try {
const upgradePromise = cli.upgradeRoom(roomId, args);

// We have to wait for the js-sdk to give us the room back so
// we can more effectively abuse the MultiInviter behaviour
// which heavily relies on the Room object being available.
if (resp.invite) {
checkForUpgradeFn = async (newRoom) => {
// The upgradePromise should be done by the time we await it here.
const { replacement_room: newRoomId } = await upgradePromise;
if (newRoom.roomId !== newRoomId) return;

const toInvite = [
...room.getMembersWithMembership("join"),
...room.getMembersWithMembership("invite"),
].map(m => m.userId).filter(m => m !== cli.getUserId());

if (toInvite.length > 0) {
// Errors are handled internally to this function
await inviteUsersToRoom(newRoomId, toInvite);
}

cli.removeListener('Room', checkForUpgradeFn);
};
cli.on('Room', checkForUpgradeFn);
}

// We have to await after so that the checkForUpgradesFn has a proper reference
// to the new room's ID.
await upgradePromise;
} catch (e) {
console.error(e);

if (checkForUpgradeFn) cli.removeListener('Room', checkForUpgradeFn);

const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog');
Modal.createTrackedDialog('Slash Commands', 'room upgrade error', ErrorDialog, {
title: _t('Error upgrading room'),
description: _t(
'Double check that your server supports the room version chosen and try again.'),
});
}
if (!resp?.continue) return;
await upgradeRoom(room, args, resp.invite);
}));
}
return reject(this.getUsage());
Expand Down
Loading