2015-11-27 13:42:03 +03:00
|
|
|
/*
|
2016-01-07 07:06:39 +03:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2017-02-14 21:10:40 +03:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2015-11-27 13:42:03 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-07-12 15:58:14 +03:00
|
|
|
import Promise from 'bluebird';
|
2017-02-14 20:06:16 +03:00
|
|
|
import React from 'react';
|
2017-10-11 17:50:28 +03:00
|
|
|
import { _t, _tJsx, _td } from '../../../languageHandler';
|
2017-02-15 21:58:59 +03:00
|
|
|
import MatrixClientPeg from '../../../MatrixClientPeg';
|
2017-02-14 20:06:16 +03:00
|
|
|
import sdk from '../../../index';
|
|
|
|
import Modal from '../../../Modal';
|
|
|
|
import ObjectUtils from '../../../ObjectUtils';
|
|
|
|
import dis from '../../../dispatcher';
|
|
|
|
import UserSettingsStore from '../../../UserSettingsStore';
|
|
|
|
import AccessibleButton from '../elements/AccessibleButton';
|
2017-01-22 00:49:29 +03:00
|
|
|
|
2015-11-27 13:42:03 +03:00
|
|
|
|
2016-06-23 12:36:16 +03:00
|
|
|
// parse a string as an integer; if the input is undefined, or cannot be parsed
|
|
|
|
// as an integer, return a default.
|
|
|
|
function parseIntWithDefault(val, def) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const res = parseInt(val);
|
2016-06-23 12:36:16 +03:00
|
|
|
return isNaN(res) ? def : res;
|
|
|
|
}
|
|
|
|
|
2017-09-29 23:45:00 +03:00
|
|
|
const plEventsToLabels = {
|
|
|
|
// These will be translated for us later.
|
2017-10-11 17:50:28 +03:00
|
|
|
"m.room.avatar": _td("To change the room's avatar, you must be a"),
|
|
|
|
"m.room.name": _td("To change the room's name, you must be a"),
|
|
|
|
"m.room.canonical_alias": _td("To change the room's main address, you must be a"),
|
|
|
|
"m.room.history_visibility": _td("To change the room's history visibility, you must be a"),
|
|
|
|
"m.room.power_levels": _td("To change the permissions in the room, you must be a"),
|
|
|
|
"m.room.topic": _td("To change the topic, you must be a"),
|
2017-09-30 00:22:37 +03:00
|
|
|
|
2017-10-11 17:50:28 +03:00
|
|
|
"im.vector.modular.widgets": _td("To modify widgets in the room, you must be a"),
|
2017-09-29 23:45:00 +03:00
|
|
|
};
|
|
|
|
|
2017-09-30 00:11:48 +03:00
|
|
|
const plEventsToShow = {
|
|
|
|
// If an event is listed here, it will be shown in the PL settings. Defaults will be calculated.
|
|
|
|
"m.room.avatar": {isState: true},
|
|
|
|
"m.room.name": {isState: true},
|
|
|
|
"m.room.canonical_alias": {isState: true},
|
|
|
|
"m.room.history_visibility": {isState: true},
|
|
|
|
"m.room.power_levels": {isState: true},
|
2017-09-30 00:12:05 +03:00
|
|
|
"m.room.topic": {isState: true},
|
2017-09-30 00:22:37 +03:00
|
|
|
|
|
|
|
"im.vector.modular.widgets": {isState: true},
|
2017-10-11 19:56:17 +03:00
|
|
|
};
|
2017-09-30 00:11:48 +03:00
|
|
|
|
2017-02-15 21:58:59 +03:00
|
|
|
const BannedUser = React.createClass({
|
2017-02-14 20:54:57 +03:00
|
|
|
propTypes: {
|
2017-07-06 14:51:55 +03:00
|
|
|
canUnban: React.PropTypes.bool,
|
2017-02-15 22:01:00 +03:00
|
|
|
member: React.PropTypes.object.isRequired, // js-sdk RoomMember
|
2017-10-11 18:05:54 +03:00
|
|
|
by: React.PropTypes.string.isRequired,
|
2017-06-10 18:30:46 +03:00
|
|
|
reason: React.PropTypes.string,
|
2017-02-14 20:54:57 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
_onUnbanClick: function() {
|
|
|
|
const ConfirmUserActionDialog = sdk.getComponent("dialogs.ConfirmUserActionDialog");
|
2017-07-27 19:19:18 +03:00
|
|
|
Modal.createTrackedDialog('Confirm User Action Dialog', 'onUnbanClick', ConfirmUserActionDialog, {
|
2017-02-14 20:54:57 +03:00
|
|
|
member: this.props.member,
|
2017-06-08 16:08:51 +03:00
|
|
|
action: _t('Unban'),
|
2017-10-12 22:37:12 +03:00
|
|
|
title: _t('Unban this user?'),
|
2017-02-14 20:54:57 +03:00
|
|
|
danger: false,
|
|
|
|
onFinished: (proceed) => {
|
|
|
|
if (!proceed) return;
|
|
|
|
|
2017-02-15 21:58:59 +03:00
|
|
|
MatrixClientPeg.get().unban(
|
2017-02-14 20:54:57 +03:00
|
|
|
this.props.member.roomId, this.props.member.userId,
|
|
|
|
).catch((err) => {
|
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-03-13 01:59:41 +03:00
|
|
|
console.error("Failed to unban: " + err);
|
2017-08-10 15:49:11 +03:00
|
|
|
Modal.createTrackedDialog('Failed to unban', '', ErrorDialog, {
|
2017-05-23 17:16:31 +03:00
|
|
|
title: _t('Error'),
|
|
|
|
description: _t('Failed to unban'),
|
2017-02-14 20:54:57 +03:00
|
|
|
});
|
|
|
|
}).done();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
2017-07-06 14:51:55 +03:00
|
|
|
let unbanButton;
|
|
|
|
|
|
|
|
if (this.props.canUnban) {
|
|
|
|
unbanButton = <AccessibleButton className="mx_RoomSettings_unbanButton" onClick={this._onUnbanClick}>
|
|
|
|
{ _t('Unban') }
|
|
|
|
</AccessibleButton>;
|
|
|
|
}
|
|
|
|
|
2017-02-14 20:54:57 +03:00
|
|
|
return (
|
|
|
|
<li>
|
2017-07-06 14:51:55 +03:00
|
|
|
{ unbanButton }
|
2017-10-11 18:05:54 +03:00
|
|
|
<span title={_t("Banned by %(displayName)s", {displayName: this.props.by})}>
|
2017-10-11 19:56:17 +03:00
|
|
|
<strong>{ this.props.member.name }</strong> { this.props.member.userId }
|
|
|
|
{ this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : "" }
|
2017-09-30 01:04:12 +03:00
|
|
|
</span>
|
2017-02-14 20:54:57 +03:00
|
|
|
</li>
|
|
|
|
);
|
2017-06-10 18:30:46 +03:00
|
|
|
},
|
2017-02-15 21:58:59 +03:00
|
|
|
});
|
2017-02-14 20:54:57 +03:00
|
|
|
|
2017-02-15 21:58:59 +03:00
|
|
|
module.exports = React.createClass({
|
2015-11-27 13:42:03 +03:00
|
|
|
displayName: 'RoomSettings',
|
|
|
|
|
|
|
|
propTypes: {
|
|
|
|
room: React.PropTypes.object.isRequired,
|
2016-01-17 06:59:31 +03:00
|
|
|
onSaveClick: React.PropTypes.func,
|
2015-11-27 13:42:03 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
getInitialState: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const tags = {};
|
2016-01-17 08:13:16 +03:00
|
|
|
Object.keys(this.props.room.tags).forEach(function(tagName) {
|
2016-05-31 23:44:11 +03:00
|
|
|
tags[tagName] = ['yep'];
|
2016-01-17 08:13:16 +03:00
|
|
|
});
|
|
|
|
|
2015-11-27 13:42:03 +03:00
|
|
|
return {
|
2016-02-04 18:26:12 +03:00
|
|
|
name: this._yankValueFromEvent("m.room.name", "name"),
|
|
|
|
topic: this._yankValueFromEvent("m.room.topic", "topic"),
|
|
|
|
join_rule: this._yankValueFromEvent("m.room.join_rules", "join_rule"),
|
|
|
|
history_visibility: this._yankValueFromEvent("m.room.history_visibility", "history_visibility"),
|
|
|
|
guest_access: this._yankValueFromEvent("m.room.guest_access", "guest_access"),
|
2016-01-08 06:22:38 +03:00
|
|
|
power_levels_changed: false,
|
2016-01-17 08:13:16 +03:00
|
|
|
tags_changed: false,
|
|
|
|
tags: tags,
|
2016-07-18 17:22:08 +03:00
|
|
|
// isRoomPublished is loaded async in componentWillMount so when the component
|
|
|
|
// inits, the saved value will always be undefined, however getInitialState()
|
|
|
|
// is also called from the saving code so we must return the correct value here
|
|
|
|
// if we have it (although this could race if the user saves before we load whether
|
2016-07-18 17:36:19 +03:00
|
|
|
// the room is published or not).
|
2016-08-03 20:23:38 +03:00
|
|
|
// Default to false if it's undefined, otherwise react complains about changing
|
|
|
|
// components from uncontrolled to controlled
|
|
|
|
isRoomPublished: this._originalIsRoomPublished || false,
|
2015-11-27 13:42:03 +03:00
|
|
|
};
|
|
|
|
},
|
2016-03-22 03:57:40 +03:00
|
|
|
|
|
|
|
componentWillMount: function() {
|
2017-02-15 21:58:59 +03:00
|
|
|
MatrixClientPeg.get().on("RoomMember.membership", this._onRoomMemberMembership);
|
2017-02-14 20:54:57 +03:00
|
|
|
|
2017-02-15 21:58:59 +03:00
|
|
|
MatrixClientPeg.get().getRoomDirectoryVisibility(
|
2017-10-11 19:56:17 +03:00
|
|
|
this.props.room.roomId,
|
2016-03-22 03:57:40 +03:00
|
|
|
).done((result) => {
|
2016-03-22 15:10:58 +03:00
|
|
|
this.setState({ isRoomPublished: result.visibility === "public" });
|
2016-04-12 03:27:12 +03:00
|
|
|
this._originalIsRoomPublished = result.visibility === "public";
|
2016-03-22 03:57:40 +03:00
|
|
|
}, (err) => {
|
|
|
|
console.error("Failed to get room visibility: " + err);
|
|
|
|
});
|
2016-04-12 19:18:32 +03:00
|
|
|
|
|
|
|
dis.dispatch({
|
2017-10-25 13:09:48 +03:00
|
|
|
action: 'panel_disable',
|
|
|
|
sideDisabled: true,
|
|
|
|
middleDisabled: true,
|
2016-04-12 19:18:32 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
componentWillUnmount: function() {
|
2017-02-15 22:01:00 +03:00
|
|
|
const cli = MatrixClientPeg.get();
|
|
|
|
if (cli) {
|
|
|
|
cli.removeListener("RoomMember.membership", this._onRoomMemberMembership);
|
|
|
|
}
|
2017-02-14 20:54:57 +03:00
|
|
|
|
2016-04-12 19:18:32 +03:00
|
|
|
dis.dispatch({
|
2017-10-25 13:09:48 +03:00
|
|
|
action: 'panel_disable',
|
|
|
|
sideDisabled: false,
|
|
|
|
middleDisabled: false,
|
2016-04-12 19:18:32 +03:00
|
|
|
});
|
2016-03-22 03:57:40 +03:00
|
|
|
},
|
2016-04-12 03:27:12 +03:00
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
setName: function(name) {
|
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
name: name,
|
2016-02-04 18:26:12 +03:00
|
|
|
});
|
|
|
|
},
|
2016-04-12 03:27:12 +03:00
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
setTopic: function(topic) {
|
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
topic: topic,
|
2016-02-04 18:26:12 +03:00
|
|
|
});
|
|
|
|
},
|
2016-04-12 03:27:12 +03:00
|
|
|
|
2017-07-12 17:15:59 +03:00
|
|
|
/**
|
|
|
|
* Returns a promise which resolves once all of the save operations have completed or failed.
|
|
|
|
*
|
|
|
|
* The result is a list of promise state snapshots, each with the form
|
|
|
|
* `{ state: "fulfilled", value: v }` or `{ state: "rejected", reason: r }`.
|
|
|
|
*/
|
2016-02-04 18:26:12 +03:00
|
|
|
save: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const stateWasSetDefer = Promise.defer();
|
2016-02-04 18:26:12 +03:00
|
|
|
// the caller may have JUST called setState on stuff, so we need to re-render before saving
|
|
|
|
// else we won't use the latest values of things.
|
|
|
|
// We can be a bit cheeky here and set a loading flag, and listen for the callback on that
|
|
|
|
// to know when things have been set.
|
|
|
|
this.setState({ _loading: true}, () => {
|
|
|
|
stateWasSetDefer.resolve();
|
|
|
|
this.setState({ _loading: false});
|
|
|
|
});
|
2016-04-12 03:27:12 +03:00
|
|
|
|
2017-07-12 17:15:59 +03:00
|
|
|
function mapPromiseToSnapshot(p) {
|
|
|
|
return p.then((r) => {
|
|
|
|
return { state: "fulfilled", value: r };
|
|
|
|
}, (e) => {
|
|
|
|
return { state: "rejected", reason: e };
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
return stateWasSetDefer.promise.then(() => {
|
2017-07-12 17:15:59 +03:00
|
|
|
return Promise.all(
|
|
|
|
this._calcSavePromises().map(mapPromiseToSnapshot),
|
|
|
|
);
|
2016-02-04 18:26:12 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-09-15 02:43:30 +03:00
|
|
|
_calcSavePromises: function() {
|
2016-02-04 18:26:12 +03:00
|
|
|
const roomId = this.props.room.roomId;
|
2017-10-11 19:56:17 +03:00
|
|
|
const promises = this.saveAliases(); // returns Promise[]
|
|
|
|
const originalState = this.getInitialState();
|
2016-02-05 14:59:19 +03:00
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
// diff between original state and this.state to work out what has been changed
|
|
|
|
console.log("Original: %s", JSON.stringify(originalState));
|
|
|
|
console.log("New: %s", JSON.stringify(this.state));
|
2016-02-05 14:59:19 +03:00
|
|
|
|
|
|
|
// name and topic
|
2016-02-05 14:27:11 +03:00
|
|
|
if (this._hasDiff(this.state.name, originalState.name)) {
|
2017-02-15 21:58:59 +03:00
|
|
|
promises.push(MatrixClientPeg.get().setRoomName(roomId, this.state.name));
|
2016-02-04 18:26:12 +03:00
|
|
|
}
|
2016-02-05 14:27:11 +03:00
|
|
|
if (this._hasDiff(this.state.topic, originalState.topic)) {
|
2017-02-15 21:58:59 +03:00
|
|
|
promises.push(MatrixClientPeg.get().setRoomTopic(roomId, this.state.topic));
|
2016-02-04 18:26:12 +03:00
|
|
|
}
|
2016-02-05 14:59:19 +03:00
|
|
|
|
2016-02-05 17:38:28 +03:00
|
|
|
if (this.state.history_visibility !== originalState.history_visibility) {
|
2017-02-15 21:58:59 +03:00
|
|
|
promises.push(MatrixClientPeg.get().sendStateEvent(
|
2016-02-05 17:38:28 +03:00
|
|
|
roomId, "m.room.history_visibility",
|
|
|
|
{ history_visibility: this.state.history_visibility },
|
2017-10-11 19:56:17 +03:00
|
|
|
"",
|
2016-02-05 17:38:28 +03:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2016-03-22 03:57:40 +03:00
|
|
|
if (this.state.isRoomPublished !== originalState.isRoomPublished) {
|
2017-02-15 21:58:59 +03:00
|
|
|
promises.push(MatrixClientPeg.get().setRoomDirectoryVisibility(
|
2016-04-12 03:27:12 +03:00
|
|
|
roomId,
|
2017-10-11 19:56:17 +03:00
|
|
|
this.state.isRoomPublished ? "public" : "private",
|
2016-03-22 03:57:40 +03:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2016-02-05 17:38:28 +03:00
|
|
|
if (this.state.join_rule !== originalState.join_rule) {
|
2017-02-15 21:58:59 +03:00
|
|
|
promises.push(MatrixClientPeg.get().sendStateEvent(
|
2016-02-05 17:38:28 +03:00
|
|
|
roomId, "m.room.join_rules",
|
|
|
|
{ join_rule: this.state.join_rule },
|
2017-10-11 19:56:17 +03:00
|
|
|
"",
|
2016-02-05 17:38:28 +03:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.state.guest_access !== originalState.guest_access) {
|
2017-02-15 21:58:59 +03:00
|
|
|
promises.push(MatrixClientPeg.get().sendStateEvent(
|
2016-02-05 17:38:28 +03:00
|
|
|
roomId, "m.room.guest_access",
|
|
|
|
{ guest_access: this.state.guest_access },
|
2017-10-11 19:56:17 +03:00
|
|
|
"",
|
2016-02-05 17:38:28 +03:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2016-02-05 14:59:19 +03:00
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
// power levels
|
2017-10-11 19:56:17 +03:00
|
|
|
const powerLevels = this._getPowerLevels();
|
2016-02-05 14:59:19 +03:00
|
|
|
if (powerLevels) {
|
2017-02-15 21:58:59 +03:00
|
|
|
promises.push(MatrixClientPeg.get().sendStateEvent(
|
2017-10-11 19:56:17 +03:00
|
|
|
roomId, "m.room.power_levels", powerLevels, "",
|
2016-02-05 14:59:19 +03:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
// tags
|
2016-02-05 14:59:19 +03:00
|
|
|
if (this.state.tags_changed) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const tagDiffs = ObjectUtils.getKeyValueArrayDiffs(originalState.tags, this.state.tags);
|
2016-05-31 23:44:11 +03:00
|
|
|
// [ {place: add, key: "m.favourite", val: ["yep"]} ]
|
2016-02-05 14:59:19 +03:00
|
|
|
tagDiffs.forEach(function(diff) {
|
|
|
|
switch (diff.place) {
|
|
|
|
case "add":
|
|
|
|
promises.push(
|
2017-10-11 19:56:17 +03:00
|
|
|
MatrixClientPeg.get().setRoomTag(roomId, diff.key, {}),
|
2016-02-05 14:59:19 +03:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
case "del":
|
|
|
|
promises.push(
|
2017-10-11 19:56:17 +03:00
|
|
|
MatrixClientPeg.get().deleteRoomTag(roomId, diff.key),
|
2016-02-05 14:59:19 +03:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
console.error("Unknown tag operation: %s", diff.place);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-02-05 14:27:11 +03:00
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
// color scheme
|
2017-10-11 19:56:17 +03:00
|
|
|
let p;
|
2016-09-15 02:43:30 +03:00
|
|
|
p = this.saveColor();
|
2017-07-14 16:24:35 +03:00
|
|
|
if (!p.isFulfilled()) {
|
2016-09-15 02:43:30 +03:00
|
|
|
promises.push(p);
|
|
|
|
}
|
2016-04-12 03:27:12 +03:00
|
|
|
|
2016-07-20 14:03:13 +03:00
|
|
|
// url preview settings
|
2017-10-11 19:56:17 +03:00
|
|
|
const ps = this.saveUrlPreviewSettings();
|
2016-09-15 02:43:30 +03:00
|
|
|
if (ps.length > 0) {
|
2016-09-15 02:49:10 +03:00
|
|
|
promises.push(ps);
|
2016-09-15 02:43:30 +03:00
|
|
|
}
|
2016-07-20 14:03:13 +03:00
|
|
|
|
2017-10-04 15:19:57 +03:00
|
|
|
// related groups
|
|
|
|
promises.push(this.saveRelatedGroups());
|
|
|
|
|
2016-06-23 14:21:31 +03:00
|
|
|
// encryption
|
2017-01-21 20:39:31 +03:00
|
|
|
p = this.saveEnableEncryption();
|
2017-07-14 16:24:35 +03:00
|
|
|
if (!p.isFulfilled()) {
|
2016-09-15 02:43:30 +03:00
|
|
|
promises.push(p);
|
|
|
|
}
|
2016-06-23 14:21:31 +03:00
|
|
|
|
2017-01-21 20:39:31 +03:00
|
|
|
this.saveBlacklistUnverifiedDevicesPerRoom();
|
|
|
|
|
2016-07-20 14:03:13 +03:00
|
|
|
console.log("Performing %s operations: %s", promises.length, JSON.stringify(promises));
|
2016-09-15 02:43:30 +03:00
|
|
|
return promises;
|
2016-02-04 18:26:12 +03:00
|
|
|
},
|
2015-11-27 13:42:03 +03:00
|
|
|
|
2016-02-02 15:46:14 +03:00
|
|
|
saveAliases: function() {
|
2017-07-12 16:02:00 +03:00
|
|
|
if (!this.refs.alias_settings) { return [Promise.resolve()]; }
|
2016-02-02 15:46:14 +03:00
|
|
|
return this.refs.alias_settings.saveSettings();
|
|
|
|
},
|
|
|
|
|
2017-10-04 15:19:57 +03:00
|
|
|
saveRelatedGroups: function() {
|
|
|
|
if (!this.refs.related_groups) { return Promise.resolve(); }
|
|
|
|
return this.refs.related_groups.saveSettings();
|
|
|
|
},
|
|
|
|
|
2016-02-05 14:27:11 +03:00
|
|
|
saveColor: function() {
|
2017-07-12 16:02:00 +03:00
|
|
|
if (!this.refs.color_settings) { return Promise.resolve(); }
|
2016-02-05 14:27:11 +03:00
|
|
|
return this.refs.color_settings.saveSettings();
|
|
|
|
},
|
|
|
|
|
2016-07-20 14:03:13 +03:00
|
|
|
saveUrlPreviewSettings: function() {
|
2017-07-12 16:02:00 +03:00
|
|
|
if (!this.refs.url_preview_settings) { return Promise.resolve(); }
|
2016-07-20 14:03:13 +03:00
|
|
|
return this.refs.url_preview_settings.saveSettings();
|
|
|
|
},
|
|
|
|
|
2017-01-21 20:39:31 +03:00
|
|
|
saveEnableEncryption: function() {
|
2017-07-12 16:02:00 +03:00
|
|
|
if (!this.refs.encrypt) { return Promise.resolve(); }
|
2016-06-23 14:21:31 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const encrypt = this.refs.encrypt.checked;
|
2017-07-12 16:02:00 +03:00
|
|
|
if (!encrypt) { return Promise.resolve(); }
|
2016-06-23 14:21:31 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const roomId = this.props.room.roomId;
|
2017-02-15 21:58:59 +03:00
|
|
|
return MatrixClientPeg.get().sendStateEvent(
|
2016-06-23 14:21:31 +03:00
|
|
|
roomId, "m.room.encryption",
|
2017-10-11 19:56:17 +03:00
|
|
|
{ algorithm: "m.megolm.v1.aes-sha2" },
|
2016-06-23 14:21:31 +03:00
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2017-01-21 20:39:31 +03:00
|
|
|
saveBlacklistUnverifiedDevicesPerRoom: function() {
|
|
|
|
if (!this.refs.blacklistUnverified) return;
|
|
|
|
if (this._isRoomBlacklistUnverified() !== this.refs.blacklistUnverified.checked) {
|
|
|
|
this._setRoomBlacklistUnverified(this.refs.blacklistUnverified.checked);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_isRoomBlacklistUnverified: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const blacklistUnverifiedDevicesPerRoom = UserSettingsStore.getLocalSettings().blacklistUnverifiedDevicesPerRoom;
|
2017-01-21 20:39:31 +03:00
|
|
|
if (blacklistUnverifiedDevicesPerRoom) {
|
|
|
|
return blacklistUnverifiedDevicesPerRoom[this.props.room.roomId];
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
_setRoomBlacklistUnverified: function(value) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const blacklistUnverifiedDevicesPerRoom = UserSettingsStore.getLocalSettings().blacklistUnverifiedDevicesPerRoom || {};
|
2017-01-21 20:39:31 +03:00
|
|
|
blacklistUnverifiedDevicesPerRoom[this.props.room.roomId] = value;
|
2017-01-22 00:49:29 +03:00
|
|
|
UserSettingsStore.setLocalSetting('blacklistUnverifiedDevicesPerRoom', blacklistUnverifiedDevicesPerRoom);
|
2017-01-21 20:39:31 +03:00
|
|
|
|
|
|
|
this.props.room.setBlacklistUnverifiedDevices(value);
|
|
|
|
},
|
|
|
|
|
2016-02-05 14:27:11 +03:00
|
|
|
_hasDiff: function(strA, strB) {
|
|
|
|
// treat undefined as an empty string because other components may blindly
|
|
|
|
// call setName("") when there has been no diff made to the name!
|
|
|
|
strA = strA || "";
|
|
|
|
strB = strB || "";
|
|
|
|
return strA !== strB;
|
|
|
|
},
|
|
|
|
|
2016-02-05 14:59:19 +03:00
|
|
|
_getPowerLevels: function() {
|
2015-11-27 13:42:03 +03:00
|
|
|
if (!this.state.power_levels_changed) return undefined;
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let powerLevels = this.props.room.currentState.getStateEvents('m.room.power_levels', '');
|
2016-02-05 18:48:04 +03:00
|
|
|
powerLevels = powerLevels ? powerLevels.getContent() : {};
|
2015-11-27 13:42:03 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
for (const key of Object.keys(this.refs).filter((k) => k.startsWith("event_levels_"))) {
|
2017-09-29 23:02:31 +03:00
|
|
|
const eventType = key.substring("event_levels_".length);
|
|
|
|
powerLevels.events[eventType] = parseInt(this.refs[key].getValue());
|
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const newPowerLevels = {
|
2016-01-17 05:48:55 +03:00
|
|
|
ban: parseInt(this.refs.ban.getValue()),
|
|
|
|
kick: parseInt(this.refs.kick.getValue()),
|
|
|
|
redact: parseInt(this.refs.redact.getValue()),
|
|
|
|
invite: parseInt(this.refs.invite.getValue()),
|
|
|
|
events_default: parseInt(this.refs.events_default.getValue()),
|
|
|
|
state_default: parseInt(this.refs.state_default.getValue()),
|
|
|
|
users_default: parseInt(this.refs.users_default.getValue()),
|
2016-02-05 18:48:04 +03:00
|
|
|
users: powerLevels.users,
|
|
|
|
events: powerLevels.events,
|
2015-11-27 13:42:03 +03:00
|
|
|
};
|
|
|
|
|
2016-02-05 18:48:04 +03:00
|
|
|
return newPowerLevels;
|
2015-11-27 13:42:03 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onPowerLevelsChanged: function() {
|
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
power_levels_changed: true,
|
2015-11-27 13:42:03 +03:00
|
|
|
});
|
|
|
|
},
|
2016-06-23 12:36:16 +03:00
|
|
|
|
2016-02-04 18:26:12 +03:00
|
|
|
_yankValueFromEvent: function(stateEventType, keyName, defaultValue) {
|
|
|
|
// E.g.("m.room.name","name") would yank the "name" content key from "m.room.name"
|
2017-08-02 15:42:24 +03:00
|
|
|
const event = this.props.room.currentState.getStateEvents(stateEventType, '');
|
2016-02-04 18:26:12 +03:00
|
|
|
if (!event) {
|
|
|
|
return defaultValue;
|
|
|
|
}
|
2017-08-02 15:42:24 +03:00
|
|
|
const content = event.getContent();
|
|
|
|
return keyName in content ? content[keyName] : defaultValue;
|
2016-02-04 18:26:12 +03:00
|
|
|
},
|
2016-02-05 17:38:28 +03:00
|
|
|
|
|
|
|
_onHistoryRadioToggle: function(ev) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const self = this;
|
|
|
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
2016-03-20 01:32:44 +03:00
|
|
|
|
|
|
|
// cancel the click unless the user confirms it
|
|
|
|
ev.preventDefault();
|
2017-10-11 19:56:17 +03:00
|
|
|
const value = ev.target.value;
|
2016-03-20 01:32:44 +03:00
|
|
|
|
2017-07-27 19:19:18 +03:00
|
|
|
Modal.createTrackedDialog('Privacy warning', '', QuestionDialog, {
|
2017-05-23 17:16:31 +03:00
|
|
|
title: _t('Privacy warning'),
|
2016-03-20 01:32:44 +03:00
|
|
|
description:
|
|
|
|
<div>
|
2017-10-11 19:56:17 +03:00
|
|
|
{ _t('Changes to who can read history will only apply to future messages in this room') }.<br />
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('The visibility of existing history will be unchanged') }.
|
2016-03-20 01:32:44 +03:00
|
|
|
</div>,
|
2017-05-23 17:16:31 +03:00
|
|
|
button: _t('Continue'),
|
2016-03-20 01:32:44 +03:00
|
|
|
onFinished: function(confirmed) {
|
|
|
|
if (confirmed) {
|
|
|
|
self.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
history_visibility: value,
|
2016-03-20 01:32:44 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2016-02-05 17:38:28 +03:00
|
|
|
});
|
|
|
|
},
|
2016-06-23 12:36:16 +03:00
|
|
|
|
2016-03-22 03:57:40 +03:00
|
|
|
_onRoomAccessRadioToggle: function(ev) {
|
2016-03-22 15:10:58 +03:00
|
|
|
// join_rule
|
|
|
|
// INVITE | PUBLIC
|
|
|
|
// ----------------------+----------------
|
|
|
|
// guest CAN_JOIN | inv_only | pub_with_guest
|
|
|
|
// access ----------------------+----------------
|
|
|
|
// FORBIDDEN | inv_only | pub_no_guest
|
|
|
|
// ----------------------+----------------
|
|
|
|
|
2016-03-22 03:57:40 +03:00
|
|
|
switch (ev.target.value) {
|
|
|
|
case "invite_only":
|
2016-03-22 15:10:58 +03:00
|
|
|
this.setState({
|
2016-03-22 03:57:40 +03:00
|
|
|
join_rule: "invite",
|
2016-03-22 15:26:38 +03:00
|
|
|
// we always set guests can_join here as it makes no sense to have
|
|
|
|
// an invite-only room that guests can't join. If you explicitly
|
|
|
|
// invite them, you clearly want them to join, whether they're a
|
|
|
|
// guest or not. In practice, guest_access should probably have
|
|
|
|
// been implemented as part of the join_rules enum.
|
2016-03-22 03:57:40 +03:00
|
|
|
guest_access: "can_join",
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "public_no_guests":
|
2016-03-22 15:10:58 +03:00
|
|
|
this.setState({
|
2016-03-22 03:57:40 +03:00
|
|
|
join_rule: "public",
|
|
|
|
guest_access: "forbidden",
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "public_with_guests":
|
2016-03-22 15:10:58 +03:00
|
|
|
this.setState({
|
2016-03-22 03:57:40 +03:00
|
|
|
join_rule: "public",
|
|
|
|
guest_access: "can_join",
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-02-04 19:18:59 +03:00
|
|
|
_onToggle: function(keyName, checkedValue, uncheckedValue, ev) {
|
2016-02-04 18:26:12 +03:00
|
|
|
console.log("Checkbox toggle: %s %s", keyName, ev.target.checked);
|
2017-10-11 19:56:17 +03:00
|
|
|
const state = {};
|
2016-02-04 19:18:59 +03:00
|
|
|
state[keyName] = ev.target.checked ? checkedValue : uncheckedValue;
|
2016-02-04 18:26:12 +03:00
|
|
|
this.setState(state);
|
|
|
|
},
|
2016-01-08 06:22:38 +03:00
|
|
|
|
2016-02-05 14:59:19 +03:00
|
|
|
_onTagChange: function(tagName, event) {
|
2016-01-17 08:13:16 +03:00
|
|
|
if (event.target.checked) {
|
|
|
|
if (tagName === 'm.favourite') {
|
|
|
|
delete this.state.tags['m.lowpriority'];
|
2017-10-11 19:56:17 +03:00
|
|
|
} else if (tagName === 'm.lowpriority') {
|
2016-01-17 08:13:16 +03:00
|
|
|
delete this.state.tags['m.favourite'];
|
|
|
|
}
|
|
|
|
|
2016-02-05 14:59:19 +03:00
|
|
|
this.state.tags[tagName] = this.state.tags[tagName] || ["yep"];
|
2017-10-11 19:56:17 +03:00
|
|
|
} else {
|
2016-01-17 08:13:16 +03:00
|
|
|
delete this.state.tags[tagName];
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
tags: this.state.tags,
|
2017-10-11 19:56:17 +03:00
|
|
|
tags_changed: true,
|
2016-01-17 08:13:16 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-03-22 15:26:38 +03:00
|
|
|
mayChangeRoomAccess: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const cli = MatrixClientPeg.get();
|
|
|
|
const roomState = this.props.room.currentState;
|
2016-03-22 15:26:38 +03:00
|
|
|
return (roomState.mayClientSendStateEvent("m.room.join_rules", cli) &&
|
2017-01-20 17:22:27 +03:00
|
|
|
roomState.mayClientSendStateEvent("m.room.guest_access", cli));
|
2016-03-22 15:26:38 +03:00
|
|
|
},
|
|
|
|
|
2016-08-28 02:00:22 +03:00
|
|
|
onLeaveClick() {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'leave_room',
|
|
|
|
room_id: this.props.room.roomId,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onForgetClick() {
|
|
|
|
// FIXME: duplicated with RoomTagContextualMenu (and dead code in RoomView)
|
2017-02-15 21:58:59 +03:00
|
|
|
MatrixClientPeg.get().forget(this.props.room.roomId).done(function() {
|
2016-08-28 02:00:22 +03:00
|
|
|
dis.dispatch({ action: 'view_next_room' });
|
|
|
|
}, function(err) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const errCode = err.errcode || _t('unknown error code');
|
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-08-10 15:49:11 +03:00
|
|
|
Modal.createTrackedDialog('Failed to forget room', '', ErrorDialog, {
|
2017-05-23 17:16:31 +03:00
|
|
|
title: _t('Error'),
|
|
|
|
description: _t("Failed to forget room %(errCode)s", { errCode: errCode }),
|
2016-08-28 02:00:22 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-09-14 04:07:37 +03:00
|
|
|
onEnableEncryptionClick() {
|
2016-09-17 23:56:10 +03:00
|
|
|
if (!this.refs.encrypt.checked) return;
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
2017-07-27 19:19:18 +03:00
|
|
|
Modal.createTrackedDialog('E2E Enable Warning', '', QuestionDialog, {
|
2017-05-25 20:20:48 +03:00
|
|
|
title: _t('Warning!'),
|
2016-09-14 04:07:37 +03:00
|
|
|
description: (
|
|
|
|
<div>
|
2017-05-23 17:16:31 +03:00
|
|
|
<p>{ _t('End-to-end encryption is in beta and may not be reliable') }.</p>
|
2017-05-25 22:04:28 +03:00
|
|
|
<p>{ _t('You should not yet trust it to secure data') }.</p>
|
|
|
|
<p>{ _t('Devices will not yet be able to decrypt history from before they joined the room') }.</p>
|
|
|
|
<p>{ _t('Once encryption is enabled for a room it cannot be turned off again (for now)') }.</p>
|
2017-05-23 17:16:31 +03:00
|
|
|
<p>{ _t('Encrypted messages will not be visible on clients that do not yet implement encryption') }.</p>
|
2016-09-14 04:07:37 +03:00
|
|
|
</div>
|
|
|
|
),
|
2017-10-11 19:56:17 +03:00
|
|
|
onFinished: (confirm)=>{
|
2016-09-14 04:07:37 +03:00
|
|
|
if (!confirm) {
|
|
|
|
this.refs.encrypt.checked = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-02-14 20:54:57 +03:00
|
|
|
_onRoomMemberMembership: function() {
|
|
|
|
// Update, since our banned user list may have changed
|
|
|
|
this.forceUpdate();
|
|
|
|
},
|
|
|
|
|
2017-09-30 00:11:48 +03:00
|
|
|
_populateDefaultPlEvents: function(eventsSection, stateLevel, eventsLevel) {
|
2017-10-11 19:56:17 +03:00
|
|
|
for (const desiredEvent of Object.keys(plEventsToShow)) {
|
2017-09-30 00:11:48 +03:00
|
|
|
if (!(desiredEvent in eventsSection)) {
|
|
|
|
eventsSection[desiredEvent] = (plEventsToShow[desiredEvent].isState ? stateLevel : eventsLevel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-06-23 14:21:31 +03:00
|
|
|
_renderEncryptionSection: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const cli = MatrixClientPeg.get();
|
|
|
|
const roomState = this.props.room.currentState;
|
|
|
|
const isEncrypted = cli.isRoomEncrypted(this.props.room.roomId);
|
|
|
|
const isGlobalBlacklistUnverified = UserSettingsStore.getLocalSettings().blacklistUnverifiedDevices;
|
|
|
|
const isRoomBlacklistUnverified = this._isRoomBlacklistUnverified();
|
2017-01-21 20:39:31 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const settings =
|
2017-01-21 20:39:31 +03:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" ref="blacklistUnverified"
|
2017-10-11 19:56:17 +03:00
|
|
|
defaultChecked={isGlobalBlacklistUnverified || isRoomBlacklistUnverified}
|
|
|
|
disabled={isGlobalBlacklistUnverified || (this.refs.encrypt && !this.refs.encrypt.checked)} />
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('Never send encrypted messages to unverified devices in this room from this device') }.
|
2017-01-21 20:39:31 +03:00
|
|
|
</label>;
|
2016-06-23 14:21:31 +03:00
|
|
|
|
2017-06-10 02:08:40 +03:00
|
|
|
if (!isEncrypted && roomState.mayClientSendStateEvent("m.room.encryption", cli)) {
|
2016-09-14 04:07:37 +03:00
|
|
|
return (
|
2017-01-21 20:43:46 +03:00
|
|
|
<div>
|
|
|
|
<label>
|
2017-10-11 19:56:17 +03:00
|
|
|
<input type="checkbox" ref="encrypt" onClick={this.onEnableEncryptionClick} />
|
2017-06-10 02:08:40 +03:00
|
|
|
<img className="mx_RoomSettings_e2eIcon mx_filterFlipColor" src="img/e2e-unencrypted.svg" width="12" height="12" />
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('Enable encryption') } { _t('(warning: cannot be disabled again!)') }
|
2017-01-21 20:43:46 +03:00
|
|
|
</label>
|
|
|
|
{ settings }
|
|
|
|
</div>
|
2016-06-23 14:21:31 +03:00
|
|
|
);
|
2017-06-10 02:08:40 +03:00
|
|
|
} else {
|
2016-09-14 04:07:37 +03:00
|
|
|
return (
|
2017-01-21 20:43:46 +03:00
|
|
|
<div>
|
|
|
|
<label>
|
|
|
|
{ isEncrypted
|
2017-06-13 19:39:20 +03:00
|
|
|
? <img className="mx_RoomSettings_e2eIcon" src="img/e2e-verified.svg" width="10" height="12" />
|
2017-06-10 02:08:40 +03:00
|
|
|
: <img className="mx_RoomSettings_e2eIcon mx_filterFlipColor" src="img/e2e-unencrypted.svg" width="12" height="12" />
|
2017-01-21 20:43:46 +03:00
|
|
|
}
|
2017-06-08 16:08:51 +03:00
|
|
|
{ isEncrypted ? _t("Encryption is enabled in this room") : _t("Encryption is not enabled in this room") }.
|
2017-01-21 20:43:46 +03:00
|
|
|
</label>
|
|
|
|
{ settings }
|
|
|
|
</div>
|
2016-09-14 04:07:37 +03:00
|
|
|
);
|
|
|
|
}
|
2016-06-23 14:21:31 +03:00
|
|
|
},
|
|
|
|
|
2015-11-27 13:42:03 +03:00
|
|
|
render: function() {
|
2016-01-13 16:15:13 +03:00
|
|
|
// TODO: go through greying out things you don't have permission to change
|
|
|
|
// (or turning them into informative stuff)
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const AliasSettings = sdk.getComponent("room_settings.AliasSettings");
|
|
|
|
const ColorSettings = sdk.getComponent("room_settings.ColorSettings");
|
|
|
|
const UrlPreviewSettings = sdk.getComponent("room_settings.UrlPreviewSettings");
|
|
|
|
const RelatedGroupSettings = sdk.getComponent("room_settings.RelatedGroupSettings");
|
|
|
|
const EditableText = sdk.getComponent('elements.EditableText');
|
|
|
|
const PowerSelector = sdk.getComponent('elements.PowerSelector');
|
|
|
|
const Loader = sdk.getComponent("elements.Spinner");
|
|
|
|
|
|
|
|
const cli = MatrixClientPeg.get();
|
|
|
|
const roomState = this.props.room.currentState;
|
|
|
|
const user_id = cli.credentials.userId;
|
|
|
|
|
|
|
|
const power_level_event = roomState.getStateEvents('m.room.power_levels', '');
|
|
|
|
const power_levels = power_level_event ? power_level_event.getContent() : {};
|
|
|
|
const events_levels = power_levels.events || {};
|
|
|
|
const user_levels = power_levels.users || {};
|
|
|
|
|
|
|
|
const ban_level = parseIntWithDefault(power_levels.ban, 50);
|
|
|
|
const kick_level = parseIntWithDefault(power_levels.kick, 50);
|
|
|
|
const redact_level = parseIntWithDefault(power_levels.redact, 50);
|
|
|
|
const invite_level = parseIntWithDefault(power_levels.invite, 50);
|
|
|
|
const send_level = parseIntWithDefault(power_levels.events_default, 0);
|
|
|
|
const state_level = power_level_event ? parseIntWithDefault(power_levels.state_default, 50) : 0;
|
|
|
|
const default_user_level = parseIntWithDefault(power_levels.users_default, 0);
|
2016-06-23 12:36:16 +03:00
|
|
|
|
2017-09-30 00:11:48 +03:00
|
|
|
this._populateDefaultPlEvents(events_levels, state_level, send_level);
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let current_user_level = user_levels[user_id];
|
2016-06-23 12:36:16 +03:00
|
|
|
if (current_user_level === undefined) {
|
|
|
|
current_user_level = default_user_level;
|
2015-11-27 13:42:03 +03:00
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const can_change_levels = roomState.mayClientSendStateEvent("m.room.power_levels", cli);
|
2016-01-17 06:59:31 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const canSetTag = !cli.isGuest();
|
2016-01-17 08:13:16 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const self = this;
|
2016-01-08 06:22:38 +03:00
|
|
|
|
2017-10-04 16:35:13 +03:00
|
|
|
let relatedGroupsSection;
|
|
|
|
if (UserSettingsStore.isFeatureEnabled('feature_groups')) {
|
|
|
|
relatedGroupsSection = <RelatedGroupSettings ref="related_groups"
|
|
|
|
roomId={this.props.room.roomId}
|
|
|
|
canSetRelatedGroups={roomState.mayClientSendStateEvent("m.room.related_groups", cli)}
|
|
|
|
relatedGroupsEvent={this.props.room.currentState.getStateEvents('m.room.related_groups', '')} />;
|
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let userLevelsSection;
|
2016-01-20 20:12:55 +03:00
|
|
|
if (Object.keys(user_levels).length) {
|
2016-02-05 18:48:04 +03:00
|
|
|
userLevelsSection =
|
2016-01-21 01:47:42 +03:00
|
|
|
<div>
|
2017-05-23 17:16:31 +03:00
|
|
|
<h3>{ _t('Privileged Users') }</h3>
|
2016-01-21 01:47:42 +03:00
|
|
|
<ul className="mx_RoomSettings_userLevels">
|
2017-10-11 19:56:17 +03:00
|
|
|
{ Object.keys(user_levels).map(function(user, i) {
|
2016-01-21 01:47:42 +03:00
|
|
|
return (
|
|
|
|
<li className="mx_RoomSettings_userLevel" key={user}>
|
2017-10-11 19:56:17 +03:00
|
|
|
{ _t("%(user)s is a", {user: user}) } <PowerSelector value={user_levels[user]} disabled={true} />
|
2016-01-21 01:47:42 +03:00
|
|
|
</li>
|
|
|
|
);
|
2017-10-11 19:56:17 +03:00
|
|
|
}) }
|
2016-01-21 01:47:42 +03:00
|
|
|
</ul>
|
|
|
|
</div>;
|
2017-10-11 19:56:17 +03:00
|
|
|
} else {
|
2017-05-23 17:16:31 +03:00
|
|
|
userLevelsSection = <div>{ _t('No users have specific privileges in this room') }.</div>;
|
2016-01-17 05:48:55 +03:00
|
|
|
}
|
2016-01-08 06:22:38 +03:00
|
|
|
|
2017-06-10 18:30:46 +03:00
|
|
|
const banned = this.props.room.getMembersWithMembership("ban");
|
|
|
|
let bannedUsersSection;
|
2016-01-08 06:22:38 +03:00
|
|
|
if (banned.length) {
|
2017-07-06 14:51:55 +03:00
|
|
|
const canBanUsers = current_user_level >= ban_level;
|
2016-02-05 18:48:04 +03:00
|
|
|
bannedUsersSection =
|
2016-01-08 06:22:38 +03:00
|
|
|
<div>
|
2017-05-23 17:16:31 +03:00
|
|
|
<h3>{ _t('Banned users') }</h3>
|
2016-01-21 01:47:42 +03:00
|
|
|
<ul className="mx_RoomSettings_banned">
|
2017-10-11 19:56:17 +03:00
|
|
|
{ banned.map(function(member) {
|
2017-06-10 18:30:46 +03:00
|
|
|
const banEvent = member.events.member.getContent();
|
2017-10-11 18:05:54 +03:00
|
|
|
const sender = self.props.room.getMember(member.events.member.getSender());
|
|
|
|
let bannedBy = member.events.member.getSender(); // start by falling back to mxid
|
|
|
|
if (sender) bannedBy = sender.name;
|
2016-01-08 06:22:38 +03:00
|
|
|
return (
|
2017-09-30 01:04:12 +03:00
|
|
|
<BannedUser key={member.userId} canUnban={canBanUsers} member={member} reason={banEvent.reason} by={bannedBy} />
|
2016-01-08 06:22:38 +03:00
|
|
|
);
|
2017-10-11 19:56:17 +03:00
|
|
|
}) }
|
2016-01-21 01:47:42 +03:00
|
|
|
</ul>
|
2016-01-08 06:22:38 +03:00
|
|
|
</div>;
|
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let unfederatableSection;
|
2017-08-02 15:42:24 +03:00
|
|
|
if (this._yankValueFromEvent("m.room.create", "m.federate", true) === false) {
|
2016-02-05 18:48:04 +03:00
|
|
|
unfederatableSection = (
|
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('This room is not accessible by remote Matrix servers') }.
|
2016-02-05 18:48:04 +03:00
|
|
|
</div>
|
|
|
|
);
|
2016-01-15 17:22:17 +03:00
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let leaveButton = null;
|
|
|
|
const myMember = this.props.room.getMember(user_id);
|
2016-08-28 02:00:22 +03:00
|
|
|
if (myMember) {
|
|
|
|
if (myMember.membership === "join") {
|
|
|
|
leaveButton = (
|
2017-10-11 19:56:17 +03:00
|
|
|
<AccessibleButton className="mx_RoomSettings_leaveButton" onClick={this.onLeaveClick}>
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('Leave room') }
|
2017-02-14 20:06:16 +03:00
|
|
|
</AccessibleButton>
|
2016-08-28 02:00:22 +03:00
|
|
|
);
|
2017-10-11 19:56:17 +03:00
|
|
|
} else if (myMember.membership === "leave") {
|
2016-08-28 02:00:22 +03:00
|
|
|
leaveButton = (
|
2017-10-11 19:56:17 +03:00
|
|
|
<AccessibleButton className="mx_RoomSettings_leaveButton" onClick={this.onForgetClick}>
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('Forget room') }
|
2017-02-14 20:06:16 +03:00
|
|
|
</AccessibleButton>
|
2016-08-28 02:00:22 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-13 16:15:13 +03:00
|
|
|
// TODO: support editing custom events_levels
|
|
|
|
// TODO: support editing custom user_levels
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const tags = [
|
2017-05-23 17:16:31 +03:00
|
|
|
{ name: "m.favourite", label: _t('Favourite'), ref: "tag_favourite" },
|
|
|
|
{ name: "m.lowpriority", label: _t('Low priority'), ref: "tag_lowpriority" },
|
2016-01-17 08:13:16 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
Object.keys(this.state.tags).sort().forEach(function(tagName) {
|
|
|
|
if (tagName !== 'm.favourite' && tagName !== 'm.lowpriority') {
|
|
|
|
tags.push({ name: tagName, label: tagName });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-03-22 16:47:38 +03:00
|
|
|
var tagsSection = null;
|
|
|
|
if (canSetTag || self.state.tags) {
|
2016-06-23 12:36:16 +03:00
|
|
|
var tagsSection =
|
2016-03-22 16:47:38 +03:00
|
|
|
<div className="mx_RoomSettings_tags">
|
2017-10-11 19:56:17 +03:00
|
|
|
{ _t("Tagged as: ") }{ canSetTag ?
|
2016-03-22 16:47:38 +03:00
|
|
|
(tags.map(function(tag, i) {
|
2017-10-11 19:56:17 +03:00
|
|
|
return (<label key={i}>
|
2016-03-22 16:47:38 +03:00
|
|
|
<input type="checkbox"
|
2017-10-11 19:56:17 +03:00
|
|
|
ref={tag.ref}
|
|
|
|
checked={tag.name in self.state.tags}
|
|
|
|
onChange={self._onTagChange.bind(self, tag.name)} />
|
2016-03-22 16:47:38 +03:00
|
|
|
{ tag.label }
|
|
|
|
</label>);
|
|
|
|
})) : (self.state.tags && self.state.tags.join) ? self.state.tags.join(", ") : ""
|
|
|
|
}
|
2017-01-20 17:22:27 +03:00
|
|
|
</div>;
|
2016-03-22 16:47:38 +03:00
|
|
|
}
|
2016-01-17 08:13:16 +03:00
|
|
|
|
2016-02-05 17:38:28 +03:00
|
|
|
// If there is no history_visibility, it is assumed to be 'shared'.
|
|
|
|
// http://matrix.org/docs/spec/r0.0.0/client_server.html#id31
|
2017-10-11 19:56:17 +03:00
|
|
|
const historyVisibility = this.state.history_visibility || "shared";
|
2016-02-05 17:38:28 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let addressWarning;
|
|
|
|
const aliasEvents = this.props.room.currentState.getStateEvents('m.room.aliases') || [];
|
|
|
|
let aliasCount = 0;
|
2016-03-22 03:57:40 +03:00
|
|
|
aliasEvents.forEach((event) => {
|
|
|
|
aliasCount += event.getContent().aliases.length;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (this.state.join_rule === "public" && aliasCount == 0) {
|
|
|
|
addressWarning =
|
|
|
|
<div className="mx_RoomSettings_warning">
|
2017-06-08 16:45:59 +03:00
|
|
|
{ _tJsx(
|
2017-06-08 16:08:51 +03:00
|
|
|
'To link to a room it must have <a>an address</a>.',
|
|
|
|
/<a>(.*?)<\/a>/,
|
2017-10-11 19:56:17 +03:00
|
|
|
(sub) => <a href="#addresses">{ sub }</a>,
|
|
|
|
) }
|
2017-01-20 17:22:27 +03:00
|
|
|
</div>;
|
2016-03-22 03:57:40 +03:00
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let inviteGuestWarning;
|
2016-03-22 15:10:58 +03:00
|
|
|
if (this.state.join_rule !== "public" && this.state.guest_access === "forbidden") {
|
|
|
|
inviteGuestWarning =
|
|
|
|
<div className="mx_RoomSettings_warning">
|
2017-10-11 19:56:17 +03:00
|
|
|
{ _t('Guests cannot join this room even if explicitly invited.') } <a href="#" onClick={(e) => {
|
2016-03-22 15:10:58 +03:00
|
|
|
this.setState({ join_rule: "invite", guest_access: "can_join" });
|
|
|
|
e.preventDefault();
|
2017-05-23 17:16:31 +03:00
|
|
|
}}>{ _t('Click here to fix') }</a>.
|
2017-01-20 17:22:27 +03:00
|
|
|
</div>;
|
2016-03-22 15:10:58 +03:00
|
|
|
}
|
|
|
|
|
2015-11-27 13:42:03 +03:00
|
|
|
return (
|
|
|
|
<div className="mx_RoomSettings">
|
2016-01-08 06:22:38 +03:00
|
|
|
|
2016-08-28 02:00:22 +03:00
|
|
|
{ leaveButton }
|
|
|
|
|
2016-02-05 18:48:04 +03:00
|
|
|
{ tagsSection }
|
2016-01-17 08:13:16 +03:00
|
|
|
|
2016-01-18 22:56:38 +03:00
|
|
|
<div className="mx_RoomSettings_toggles">
|
2016-03-22 03:57:40 +03:00
|
|
|
<div className="mx_RoomSettings_settings">
|
2017-05-23 17:16:31 +03:00
|
|
|
<h3>{ _t('Who can access this room?') }</h3>
|
2016-03-22 15:10:58 +03:00
|
|
|
{ inviteGuestWarning }
|
2016-03-22 03:57:40 +03:00
|
|
|
<label>
|
|
|
|
<input type="radio" name="roomVis" value="invite_only"
|
2017-10-11 19:56:17 +03:00
|
|
|
disabled={!this.mayChangeRoomAccess()}
|
2016-03-22 03:57:40 +03:00
|
|
|
onChange={this._onRoomAccessRadioToggle}
|
2017-10-11 19:56:17 +03:00
|
|
|
checked={this.state.join_rule !== "public"} />
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('Only people who have been invited') }
|
2016-03-22 03:57:40 +03:00
|
|
|
</label>
|
|
|
|
<label>
|
|
|
|
<input type="radio" name="roomVis" value="public_no_guests"
|
2017-10-11 19:56:17 +03:00
|
|
|
disabled={!this.mayChangeRoomAccess()}
|
2016-03-22 03:57:40 +03:00
|
|
|
onChange={this._onRoomAccessRadioToggle}
|
2017-10-11 19:56:17 +03:00
|
|
|
checked={this.state.join_rule === "public" && this.state.guest_access !== "can_join"} />
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('Anyone who knows the room\'s link, apart from guests') }
|
2016-03-22 03:57:40 +03:00
|
|
|
</label>
|
|
|
|
<label>
|
|
|
|
<input type="radio" name="roomVis" value="public_with_guests"
|
2017-10-11 19:56:17 +03:00
|
|
|
disabled={!this.mayChangeRoomAccess()}
|
2016-03-22 03:57:40 +03:00
|
|
|
onChange={this._onRoomAccessRadioToggle}
|
2017-10-11 19:56:17 +03:00
|
|
|
checked={this.state.join_rule === "public" && this.state.guest_access === "can_join"} />
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('Anyone who knows the room\'s link, including guests') }
|
2016-03-22 03:57:40 +03:00
|
|
|
</label>
|
|
|
|
{ addressWarning }
|
2017-10-11 19:56:17 +03:00
|
|
|
<br />
|
2016-09-14 04:07:37 +03:00
|
|
|
{ this._renderEncryptionSection() }
|
2016-03-22 03:57:40 +03:00
|
|
|
<label>
|
2017-10-11 19:56:17 +03:00
|
|
|
<input type="checkbox" disabled={!roomState.mayClientSendStateEvent("m.room.aliases", cli)}
|
|
|
|
onChange={this._onToggle.bind(this, "isRoomPublished", true, false)}
|
|
|
|
checked={this.state.isRoomPublished} />
|
|
|
|
{ _t("Publish this room to the public in %(domain)s's room directory?", { domain: MatrixClientPeg.get().getDomain() }) }
|
2016-03-22 03:57:40 +03:00
|
|
|
</label>
|
|
|
|
</div>
|
2016-02-05 17:38:28 +03:00
|
|
|
<div className="mx_RoomSettings_settings">
|
2017-05-23 17:16:31 +03:00
|
|
|
<h3>{ _t('Who can read history?') }</h3>
|
2016-03-22 03:57:40 +03:00
|
|
|
<label>
|
|
|
|
<input type="radio" name="historyVis" value="world_readable"
|
2017-10-11 19:56:17 +03:00
|
|
|
disabled={!roomState.mayClientSendStateEvent("m.room.history_visibility", cli)}
|
2016-03-20 01:32:44 +03:00
|
|
|
checked={historyVisibility === "world_readable"}
|
2016-02-05 17:38:28 +03:00
|
|
|
onChange={this._onHistoryRadioToggle} />
|
2017-10-11 19:56:17 +03:00
|
|
|
{ _t("Anyone") }
|
2016-02-05 17:38:28 +03:00
|
|
|
</label>
|
2016-03-22 03:57:40 +03:00
|
|
|
<label>
|
|
|
|
<input type="radio" name="historyVis" value="shared"
|
2017-10-11 19:56:17 +03:00
|
|
|
disabled={!roomState.mayClientSendStateEvent("m.room.history_visibility", cli)}
|
2016-03-20 01:32:44 +03:00
|
|
|
checked={historyVisibility === "shared"}
|
2016-02-05 17:38:28 +03:00
|
|
|
onChange={this._onHistoryRadioToggle} />
|
2017-10-15 19:01:57 +03:00
|
|
|
{ _t('Members only (since the point in time of selecting this option)') }
|
2016-02-05 17:38:28 +03:00
|
|
|
</label>
|
2016-03-22 03:57:40 +03:00
|
|
|
<label>
|
|
|
|
<input type="radio" name="historyVis" value="invited"
|
2017-10-11 19:56:17 +03:00
|
|
|
disabled={!roomState.mayClientSendStateEvent("m.room.history_visibility", cli)}
|
2016-03-20 01:32:44 +03:00
|
|
|
checked={historyVisibility === "invited"}
|
2016-02-05 17:38:28 +03:00
|
|
|
onChange={this._onHistoryRadioToggle} />
|
2017-10-15 19:01:57 +03:00
|
|
|
{ _t('Members only (since they were invited)') }
|
2016-02-05 17:38:28 +03:00
|
|
|
</label>
|
2016-03-22 03:57:40 +03:00
|
|
|
<label >
|
|
|
|
<input type="radio" name="historyVis" value="joined"
|
2017-10-11 19:56:17 +03:00
|
|
|
disabled={!roomState.mayClientSendStateEvent("m.room.history_visibility", cli)}
|
2016-03-20 01:32:44 +03:00
|
|
|
checked={historyVisibility === "joined"}
|
2016-02-05 17:38:28 +03:00
|
|
|
onChange={this._onHistoryRadioToggle} />
|
2017-10-15 19:01:57 +03:00
|
|
|
{ _t('Members only (since they joined)') }
|
2016-02-05 17:38:28 +03:00
|
|
|
</label>
|
|
|
|
</div>
|
2016-01-18 22:56:38 +03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2016-02-05 14:27:11 +03:00
|
|
|
<div>
|
2017-05-23 17:16:31 +03:00
|
|
|
<h3>{ _t('Room Colour') }</h3>
|
2016-02-05 14:27:11 +03:00
|
|
|
<ColorSettings ref="color_settings" room={this.props.room} />
|
|
|
|
</div>
|
2015-11-27 13:42:03 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
<a id="addresses" />
|
2016-03-22 03:57:40 +03:00
|
|
|
|
2016-02-02 15:46:14 +03:00
|
|
|
<AliasSettings ref="alias_settings"
|
|
|
|
roomId={this.props.room.roomId}
|
2017-10-11 19:56:17 +03:00
|
|
|
canSetCanonicalAlias={roomState.mayClientSendStateEvent("m.room.canonical_alias", cli)}
|
2016-09-28 01:39:25 +03:00
|
|
|
canSetAliases={
|
2016-11-21 13:25:48 +03:00
|
|
|
true
|
2016-09-28 01:39:25 +03:00
|
|
|
/* Originally, we arbitrarily restricted creating aliases to room admins: roomState.mayClientSendStateEvent("m.room.aliases", cli) */
|
|
|
|
}
|
2016-02-02 15:46:14 +03:00
|
|
|
canonicalAliasEvent={this.props.room.currentState.getStateEvents('m.room.canonical_alias', '')}
|
|
|
|
aliasEvents={this.props.room.currentState.getStateEvents('m.room.aliases')} />
|
2016-01-13 16:15:13 +03:00
|
|
|
|
2017-10-04 16:35:13 +03:00
|
|
|
{ relatedGroupsSection }
|
2017-10-04 15:19:57 +03:00
|
|
|
|
2016-07-18 03:35:42 +03:00
|
|
|
<UrlPreviewSettings ref="url_preview_settings" room={this.props.room} />
|
|
|
|
|
2017-05-23 17:16:31 +03:00
|
|
|
<h3>{ _t('Permissions') }</h3>
|
2016-01-08 06:22:38 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevels mx_RoomSettings_settings">
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-05-23 17:16:31 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ _t('The default role for new room members is') } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref="users_default" value={default_user_level} controlled={false} disabled={!can_change_levels || current_user_level < default_user_level} onChange={this.onPowerLevelsChanged} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-09-29 23:35:49 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ _t('To send messages, you must be a') } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref="events_default" value={send_level} controlled={false} disabled={!can_change_levels || current_user_level < send_level} onChange={this.onPowerLevelsChanged} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-09-29 23:35:49 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ _t('To invite users into the room, you must be a') } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref="invite" value={invite_level} controlled={false} disabled={!can_change_levels || current_user_level < invite_level} onChange={this.onPowerLevelsChanged} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-09-29 23:35:49 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ _t('To configure the room, you must be a') } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref="state_default" value={state_level} controlled={false} disabled={!can_change_levels || current_user_level < state_level} onChange={this.onPowerLevelsChanged} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-09-29 23:35:49 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ _t('To kick users, you must be a') } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref="kick" value={kick_level} controlled={false} disabled={!can_change_levels || current_user_level < kick_level} onChange={this.onPowerLevelsChanged} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-09-29 23:35:49 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ _t('To ban users, you must be a') } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref="ban" value={ban_level} controlled={false} disabled={!can_change_levels || current_user_level < ban_level} onChange={this.onPowerLevelsChanged} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel">
|
2017-09-29 23:35:49 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ _t('To remove other users\' messages, you must be a') } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref="redact" value={redact_level} controlled={false} disabled={!can_change_levels || current_user_level < redact_level} onChange={this.onPowerLevelsChanged} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
{ Object.keys(events_levels).map(function(event_type, i) {
|
2017-09-29 23:45:00 +03:00
|
|
|
let label = plEventsToLabels[event_type];
|
|
|
|
if (label) label = _t(label);
|
|
|
|
else label = _tJsx("To send events of type <eventType/>, you must be a", /<eventType\/>/, () => <code>{ event_type }</code>);
|
2015-11-27 13:42:03 +03:00
|
|
|
return (
|
2016-01-13 16:15:13 +03:00
|
|
|
<div className="mx_RoomSettings_powerLevel" key={event_type}>
|
2017-09-29 23:45:00 +03:00
|
|
|
<span className="mx_RoomSettings_powerLevelKey">{ label } </span>
|
2017-10-11 19:56:17 +03:00
|
|
|
<PowerSelector ref={"event_levels_"+event_type} value={events_levels[event_type]} onChange={self.onPowerLevelsChanged}
|
2017-09-29 23:02:31 +03:00
|
|
|
controlled={false} disabled={!can_change_levels || current_user_level < events_levels[event_type]} />
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
|
|
|
);
|
2017-10-11 19:56:17 +03:00
|
|
|
}) }
|
2016-01-15 19:33:50 +03:00
|
|
|
|
2016-02-05 18:48:04 +03:00
|
|
|
{ unfederatableSection }
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
|
|
|
|
2016-02-05 18:48:04 +03:00
|
|
|
{ userLevelsSection }
|
2016-01-13 16:15:13 +03:00
|
|
|
|
2016-02-05 18:48:04 +03:00
|
|
|
{ bannedUsersSection }
|
2016-01-13 16:15:13 +03:00
|
|
|
|
2017-05-23 17:16:31 +03:00
|
|
|
<h3>{ _t('Advanced') }</h3>
|
2016-01-17 05:48:55 +03:00
|
|
|
<div className="mx_RoomSettings_settings">
|
2017-05-23 17:16:31 +03:00
|
|
|
{ _t('This room\'s internal ID is') } <code>{ this.props.room.roomId }</code>
|
2016-01-17 05:48:55 +03:00
|
|
|
</div>
|
2015-11-27 13:42:03 +03:00
|
|
|
</div>
|
|
|
|
);
|
2017-10-11 19:56:17 +03:00
|
|
|
},
|
2017-02-15 21:58:59 +03:00
|
|
|
});
|