Skip to content

Commit

Permalink
Merge tag 'v3.39.1' into sc
Browse files Browse the repository at this point in the history
* Fix the sticker picker ([\matrix-org#7692](matrix-org#7692)). Fixes element-hq/element-web#20797.
* Ensure UserInfo can be rendered without a room ([\matrix-org#7687](matrix-org#7687)). Fixes element-hq/element-web#20830.
* Fix publishing address wrongly demanding the alias be available ([\matrix-org#7690](matrix-org#7690)). Fixes element-hq/element-web#12013 and element-hq/element-web#20833.
  • Loading branch information
su-ex committed Feb 1, 2022
2 parents 678d06f + 34a95f4 commit a5b6374
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
=====================================================================================================

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/elements/AppTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ export default class AppTile extends React.Component<IProps, IState> {
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();
Expand Down
21 changes: 20 additions & 1 deletion src/components/views/elements/RoomAliasField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -165,7 +167,24 @@ export default class RoomAliasField extends React.PureComponent<IProps, IState>
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 }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/right_panel/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1710,7 +1710,7 @@ const UserInfo: React.FC<IProps> = ({

const header = <React.Fragment>
{ scopeHeader }
<UserInfoHeader member={member} e2eStatus={e2eStatus} roomId={room.roomId} />
<UserInfoHeader member={member} e2eStatus={e2eStatus} roomId={room?.roomId} />
</React.Fragment>;
return <BaseCard
className={classes.join(" ")}
Expand Down
15 changes: 10 additions & 5 deletions src/components/views/room_settings/AliasSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -32,13 +32,15 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
import SettingsFieldset from "../settings/SettingsFieldset";

interface IEditableAliasesListProps {
roomId?: string;
domain?: string;
}

class EditableAliasesList extends EditableItemList<IEditableAliasesListProps> {
private aliasField = createRef<RoomAliasField>();

private onAliasAdded = async () => {
private onAliasAdded = async (ev: SyntheticEvent) => {
ev.preventDefault();
await this.aliasField.current.validate({ allowEmpty: false });

if (this.aliasField.current.isValid) {
Expand All @@ -51,7 +53,7 @@ class EditableAliasesList extends EditableItemList<IEditableAliasesListProps> {
};

protected renderNewItemField() {
const onChange = (alias) => this.onNewItemChanged({ target: { value: alias } });
const onChange = (alias: string) => this.onNewItemChanged({ target: { value: alias } });
return (
<form
onSubmit={this.onAliasAdded}
Expand All @@ -63,7 +65,9 @@ class EditableAliasesList extends EditableItemList<IEditableAliasesListProps> {
ref={this.aliasField}
onChange={onChange}
value={this.props.newItem || ""}
domain={this.props.domain} />
domain={this.props.domain}
roomId={this.props.roomId}
/>
<AccessibleButton onClick={this.onAliasAdded} kind="primary">
{ _t("Add") }
</AccessibleButton>
Expand Down Expand Up @@ -360,7 +364,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
</Field>
);

let localAliasesList;
let localAliasesList: JSX.Element;
if (this.state.localAliasesLoading) {
localAliasesList = <Spinner />;
} else {
Expand Down Expand Up @@ -428,6 +432,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
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}
/>
</SettingsFieldset>
<SettingsFieldset
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/settings/JoinRuleSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ const JoinRuleSettings = ({ room, promptUpgrade, aliasWarning, onError, beforeCh
onError,
);

const { join_rule: joinRule } = content;
const { join_rule: joinRule = JoinRule.Invite } = content || {};
const restrictedAllowRoomIds = joinRule === JoinRule.Restricted
? content.allow.filter(o => 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<string[] | undefined> => {
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a5b6374

Please sign in to comment.