From b7c8ce6920cd78ece798d0192982ad928fe84247 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 1 Feb 2022 15:40:27 +0000 Subject: [PATCH 1/5] Ensure UserInfo can be rendered without a room (#7687) (#7694) Co-authored-by: David Baker Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/right_panel/UserInfo.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index a79e382401..86c5928721 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -1518,7 +1518,7 @@ export type Member = User | RoomMember | GroupMember; const UserInfoHeader: React.FC<{ member: Member; e2eStatus: E2EStatus; - roomId: string; + roomId?: string; }> = ({ member, e2eStatus, roomId }) => { const cli = useContext(MatrixClientContext); const statusMessage = useUserStatusMessage(member); @@ -1710,7 +1710,7 @@ const UserInfo: React.FC = ({ const header = { scopeHeader } - + ; return Date: Tue, 1 Feb 2022 15:40:37 +0000 Subject: [PATCH 2/5] Fix publishing address wrongly demanding the alias be available (#7690) (#7693) Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/elements/RoomAliasField.tsx | 21 ++++++++++++++++++- .../views/room_settings/AliasSettings.tsx | 15 ++++++++----- .../views/settings/JoinRuleSettings.tsx | 4 ++-- src/i18n/strings/en_EN.json | 1 + 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/components/views/elements/RoomAliasField.tsx b/src/components/views/elements/RoomAliasField.tsx index 8e82f20a09..a8cf278a30 100644 --- a/src/components/views/elements/RoomAliasField.tsx +++ b/src/components/views/elements/RoomAliasField.tsx @@ -28,6 +28,8 @@ interface IProps { label?: string; placeholder?: string; disabled?: boolean; + // if roomId is passed then the entered alias is checked to point to this roomId, else must be unassigned + roomId?: string; onKeyDown?: KeyboardEventHandler; onChange?(value: string): void; } @@ -165,7 +167,24 @@ export default class RoomAliasField extends React.PureComponent key: "required", test: async ({ value, allowEmpty }) => allowEmpty || !!value, invalid: () => _t("Please provide an address"), - }, { + }, this.props.roomId ? { + key: "matches", + final: true, + test: async ({ value }) => { + if (!value) { + return true; + } + const client = this.context; + try { + const result = await client.getRoomIdForAlias(this.asFullAlias(value)); + return result.room_id === this.props.roomId; + } catch (err) { + console.log(err); + return false; + } + }, + invalid: () => _t("This address does not point at this room"), + } : { key: "taken", final: true, test: async ({ value }) => { diff --git a/src/components/views/room_settings/AliasSettings.tsx b/src/components/views/room_settings/AliasSettings.tsx index 1c127e5731..ec84544aae 100644 --- a/src/components/views/room_settings/AliasSettings.tsx +++ b/src/components/views/room_settings/AliasSettings.tsx @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React, { ChangeEvent, ContextType, createRef } from "react"; +import React, { ChangeEvent, ContextType, createRef, SyntheticEvent } from "react"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { logger } from "matrix-js-sdk/src/logger"; @@ -32,13 +32,15 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext"; import SettingsFieldset from "../settings/SettingsFieldset"; interface IEditableAliasesListProps { + roomId?: string; domain?: string; } class EditableAliasesList extends EditableItemList { private aliasField = createRef(); - private onAliasAdded = async () => { + private onAliasAdded = async (ev: SyntheticEvent) => { + ev.preventDefault(); await this.aliasField.current.validate({ allowEmpty: false }); if (this.aliasField.current.isValid) { @@ -51,7 +53,7 @@ class EditableAliasesList extends EditableItemList { }; protected renderNewItemField() { - const onChange = (alias) => this.onNewItemChanged({ target: { value: alias } }); + const onChange = (alias: string) => this.onNewItemChanged({ target: { value: alias } }); return (
{ ref={this.aliasField} onChange={onChange} value={this.props.newItem || ""} - domain={this.props.domain} /> + domain={this.props.domain} + roomId={this.props.roomId} + /> { _t("Add") } @@ -360,7 +364,7 @@ export default class AliasSettings extends React.Component { ); - let localAliasesList; + let localAliasesList: JSX.Element; if (this.state.localAliasesLoading) { localAliasesList = ; } else { @@ -428,6 +432,7 @@ export default class AliasSettings extends React.Component { itemsLabel={_t('Other published addresses:')} noItemsLabel={_t('No other published addresses yet, add one below')} placeholder={_t('New published address (e.g. #alias:server)')} + roomId={this.props.roomId} /> o.type === RestrictedAllowType.RoomMembership).map(o => o.room_id) + ? content.allow?.filter(o => o.type === RestrictedAllowType.RoomMembership).map(o => o.room_id) : undefined; const editRestrictedRoomIds = async (): Promise => { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index f3f38ce8ae..28a6b07faf 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2310,6 +2310,7 @@ "Missing room name or separator e.g. (my-room:domain.org)": "Missing room name or separator e.g. (my-room:domain.org)", "Some characters not allowed": "Some characters not allowed", "Please provide an address": "Please provide an address", + "This address does not point at this room": "This address does not point at this room", "This address is available to use": "This address is available to use", "This address is already in use": "This address is already in use", "This address had invalid server or is already in use": "This address had invalid server or is already in use", From 806cd264dfb3267269fcb588fa3cbfd9117f9f08 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 1 Feb 2022 15:40:50 +0000 Subject: [PATCH 3/5] Fix the sticker picker (#7692) (#7695) * Fix the sticker picker Don't stop user widgets on room change: they're not room-specific. Fixes https://github.com/vector-im/element-web/issues/20797 * Use 'userWidget' prop rather than roomId being defined --- src/components/views/elements/AppTile.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/AppTile.tsx b/src/components/views/elements/AppTile.tsx index 8b61d0d764..758270344b 100644 --- a/src/components/views/elements/AppTile.tsx +++ b/src/components/views/elements/AppTile.tsx @@ -179,7 +179,8 @@ export default class AppTile extends React.Component { if (this.props.room.roomId == RoomViewStore.getRoomId()) return; const app = this.props.app; const isActiveWidget = ActiveWidgetStore.instance.getWidgetPersistence(app.id); - if (!isActiveWidget) { + // Stop the widget if it's not the active (persistent) widget and it's not a user widget + if (!isActiveWidget && !this.props.userWidget) { ActiveWidgetStore.instance.destroyPersistentWidget(app.id); PersistedElement.destroyElement(this.persistKey); this.sgWidget?.stopMessaging(); From 710c4b77f20b14a12f395d7548c49854c9b74853 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 1 Feb 2022 15:50:25 +0000 Subject: [PATCH 4/5] Prepare changelog for v3.39.1 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccd574e7fd..4bbda5ec63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +Changes in [3.39.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.39.1) (2022-02-01) +===================================================================================================== + +## 🐛 Bug Fixes + * Fix the sticker picker ([\#7692](https://github.com/matrix-org/matrix-react-sdk/pull/7692)). Fixes vector-im/element-web#20797. + * Ensure UserInfo can be rendered without a room ([\#7687](https://github.com/matrix-org/matrix-react-sdk/pull/7687)). Fixes vector-im/element-web#20830. + * Fix publishing address wrongly demanding the alias be available ([\#7690](https://github.com/matrix-org/matrix-react-sdk/pull/7690)). Fixes vector-im/element-web#12013 and vector-im/element-web#20833. + Changes in [3.39.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.39.0) (2022-01-31) ===================================================================================================== From 34a95f4d277f8ad3f93597c93d30ffcc4583fa27 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 1 Feb 2022 15:50:26 +0000 Subject: [PATCH 5/5] v3.39.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 94322a19e2..00ad730cb1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.39.0", + "version": "3.39.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {