From b871d7e849e4ed5fa5f248c4d02136c1c1760479 Mon Sep 17 00:00:00 2001 From: Jorik Schellekens Date: Wed, 5 Aug 2020 13:53:19 +0100 Subject: [PATCH] Fix room security radios --- .../views/elements/StyledRadioGroup.tsx | 2 +- .../tabs/room/SecurityRoomSettingsTab.js | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/components/views/elements/StyledRadioGroup.tsx b/src/components/views/elements/StyledRadioGroup.tsx index 4db627e83e..6b9e992f92 100644 --- a/src/components/views/elements/StyledRadioGroup.tsx +++ b/src/components/views/elements/StyledRadioGroup.tsx @@ -34,7 +34,7 @@ interface IProps { definitions: IDefinition[]; value?: T; // if not provided no options will be selected outlined?: boolean; - onChange(newValue: T); + onChange(newValue: T): void; } function StyledRadioGroup({name, definitions, value, className, outlined, onChange}: IProps) { diff --git a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js index 7298bd0584..2ede49494d 100644 --- a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js @@ -145,7 +145,7 @@ export default class SecurityRoomSettingsTab extends React.Component { }); }; - _onRoomAccessRadioToggle = (ev) => { + _onRoomAccessRadioToggle = (roomAccess) => { // join_rule // INVITE | PUBLIC // ----------------------+---------------- @@ -162,7 +162,7 @@ export default class SecurityRoomSettingsTab extends React.Component { let joinRule = "invite"; let guestAccess = "can_join"; - switch (ev.target.value) { + switch (roomAccess) { case "invite_only": // no change - use defaults above break; @@ -191,11 +191,11 @@ export default class SecurityRoomSettingsTab extends React.Component { }); }; - _onHistoryRadioToggle = (ev) => { + _onHistoryRadioToggle = (history) => { const beforeHistory = this.state.history; - this.setState({history: ev.target.value}); + this.setState({history: history}); MatrixClientPeg.get().sendStateEvent(this.props.roomId, "m.room.history_visibility", { - history_visibility: ev.target.value, + history_visibility: history, }, "").catch((e) => { console.error(e); this.setState({history: beforeHistory}); @@ -261,25 +261,23 @@ export default class SecurityRoomSettingsTab extends React.Component {