diff --git a/src/components/views/settings/tabs/GeneralRoomSettingsTab.js b/src/components/views/settings/tabs/GeneralRoomSettingsTab.js
index 2f7ef725b73..75373a69bcb 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")}
diff --git a/src/components/views/settings/tabs/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/GeneralUserSettingsTab.js
index a504953cab4..bfcc7b945c3 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")}
-
-
-
);
}
diff --git a/src/components/views/settings/tabs/VoiceSettingsTab.js b/src/components/views/settings/tabs/VoiceSettingsTab.js
index 6e48d7f0839..65f38c78411 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(),