From a1f1dde9a4948bd92eb38e6f12fa8b597643c542 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 31 Jan 2019 21:44:34 -0700 Subject: [PATCH 1/3] Remove flair from general user settings tab Fixes https://github.com/vector-im/riot-web/issues/8327 --- .../settings/tabs/GeneralUserSettingsTab.js | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/components/views/settings/tabs/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/GeneralUserSettingsTab.js index a504953cab..bfcc7b945c 100644 --- a/src/components/views/settings/tabs/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/GeneralUserSettingsTab.js @@ -16,11 +16,6 @@ limitations under the License. import React from 'react'; import {_t} from "../../../../languageHandler"; -import MatrixClientPeg from "../../../../MatrixClientPeg"; -import GroupUserSettings from "../../groups/GroupUserSettings"; -import PropTypes from "prop-types"; -import {MatrixClient} from "matrix-js-sdk"; -import { DragDropContext } from 'react-beautiful-dnd'; import ProfileSettings from "../ProfileSettings"; import EmailAddresses from "../EmailAddresses"; import PhoneNumbers from "../PhoneNumbers"; @@ -37,10 +32,6 @@ const Modal = require("../../../../Modal"); const dis = require("../../../../dispatcher"); export default class GeneralUserSettingsTab extends React.Component { - static childContextTypes = { - matrixClient: PropTypes.instanceOf(MatrixClient), - }; - constructor() { super(); @@ -50,12 +41,6 @@ export default class GeneralUserSettingsTab extends React.Component { }; } - getChildContext() { - return { - matrixClient: MatrixClientPeg.get(), - }; - } - _onLanguageChange = (newLanguage) => { if (this.state.language === newLanguage) return; @@ -105,16 +90,10 @@ export default class GeneralUserSettingsTab extends React.Component { }; _renderProfileSection() { - // HACK/TODO: Using DragDropContext feels wrong, but we need it. return (
{_t("Profile")} - - {_t("Flair")} - - -
); } From 0c0db4ecc70f935dad7ed4cf180881e7f7fdf4ab Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 31 Jan 2019 21:48:44 -0700 Subject: [PATCH 2/3] Copy over disablement of media streams after permissions requested Fixes https://github.com/vector-im/riot-web/issues/8340 --- src/components/views/settings/tabs/VoiceSettingsTab.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/views/settings/tabs/VoiceSettingsTab.js b/src/components/views/settings/tabs/VoiceSettingsTab.js index 6e48d7f083..65f38c7841 100644 --- a/src/components/views/settings/tabs/VoiceSettingsTab.js +++ b/src/components/views/settings/tabs/VoiceSettingsTab.js @@ -40,7 +40,13 @@ export default class VoiceSettingsTab extends React.Component { this._refreshMediaDevices(); } - _refreshMediaDevices = async () => { + _refreshMediaDevices = async (stream) => { + if (stream) { + // kill stream so that we don't leave it lingering around with webcam enabled etc + // as here we called gUM to ask user for permission to their device names only + stream.getTracks().forEach((track) => track.stop()); + } + this.setState({ mediaDevices: await CallMediaHandler.getDevices(), activeAudioOutput: CallMediaHandler.getAudioOutput(), From b4fd0c3fbf6cd611d524b8d6b374f34602a342c8 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 31 Jan 2019 22:06:15 -0700 Subject: [PATCH 3/3] Add room directory publish button This was previously missed in the tab's layout. --- .../settings/tabs/GeneralRoomSettingsTab.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/components/views/settings/tabs/GeneralRoomSettingsTab.js b/src/components/views/settings/tabs/GeneralRoomSettingsTab.js index 2f7ef725b7..75373a69bc 100644 --- a/src/components/views/settings/tabs/GeneralRoomSettingsTab.js +++ b/src/components/views/settings/tabs/GeneralRoomSettingsTab.js @@ -23,6 +23,7 @@ import sdk from "../../../../index"; import AccessibleButton from "../../elements/AccessibleButton"; import {MatrixClient} from "matrix-js-sdk"; import dis from "../../../../dispatcher"; +import LabelledToggleSwitch from "../../elements/LabelledToggleSwitch"; export default class GeneralRoomSettingsTab extends React.Component { static childContextTypes = { @@ -33,12 +34,40 @@ export default class GeneralRoomSettingsTab extends React.Component { roomId: PropTypes.string.isRequired, }; + constructor() { + super(); + + this.state = { + isRoomPublished: false, // loaded async + }; + } + getChildContext() { return { matrixClient: MatrixClientPeg.get(), }; } + componentWillMount() { + MatrixClientPeg.get().getRoomDirectoryVisibility(this.props.roomId).then((result => { + this.setState({isRoomPublished: result.visibility === 'public'}); + })); + } + + onRoomPublishChange = (e) => { + const valueBefore = this.state.isRoomPublished; + const newValue = !valueBefore; + this.setState({isRoomPublished: newValue}); + + MatrixClientPeg.get().setRoomDirectoryVisibility( + this.props.roomId, + newValue ? 'public' : 'private', + ).catch(() => { + // Roll back the local echo on the change + this.setState({isRoomPublished: valueBefore}); + }); + }; + _saveAliases = (e) => { // TODO: Live modification? if (!this.refs.aliasSettings) return; @@ -67,6 +96,7 @@ export default class GeneralRoomSettingsTab extends React.Component { const room = client.getRoom(this.props.roomId); const canSetAliases = true; // Previously, we arbitrarily only allowed admins to do this + const canActuallySetAliases = room.currentState.mayClientSendStateEvent("m.room.aliases", client); const canSetCanonical = room.currentState.mayClientSendStateEvent("m.room.canonical_alias", client); const canonicalAliasEv = room.currentState.getStateEvents("m.room.canonical_alias", ''); const aliasEvents = room.currentState.getStateEvents("m.room.aliases"); @@ -90,6 +120,14 @@ export default class GeneralRoomSettingsTab extends React.Component { {_t("Save")} +
+ +
{_t("Flair")}