fix m.federate=false warning in room settings

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-08-02 13:42:24 +01:00
parent 4b4b730233
commit e9afcec5b2
No known key found for this signature in database
GPG key ID: 0435A1D4BBD34D64

View file

@ -408,11 +408,12 @@ module.exports = React.createClass({
_yankValueFromEvent: function(stateEventType, keyName, defaultValue) { _yankValueFromEvent: function(stateEventType, keyName, defaultValue) {
// E.g.("m.room.name","name") would yank the "name" content key from "m.room.name" // E.g.("m.room.name","name") would yank the "name" content key from "m.room.name"
var event = this.props.room.currentState.getStateEvents(stateEventType, ''); const event = this.props.room.currentState.getStateEvents(stateEventType, '');
if (!event) { if (!event) {
return defaultValue; return defaultValue;
} }
return event.getContent()[keyName] || defaultValue; const content = event.getContent();
return keyName in content ? content[keyName] : defaultValue;
}, },
_onHistoryRadioToggle: function(ev) { _onHistoryRadioToggle: function(ev) {
@ -704,7 +705,7 @@ module.exports = React.createClass({
} }
var unfederatableSection; var unfederatableSection;
if (this._yankValueFromEvent("m.room.create", "m.federate") === false) { if (this._yankValueFromEvent("m.room.create", "m.federate", true) === false) {
unfederatableSection = ( unfederatableSection = (
<div className="mx_RoomSettings_powerLevel"> <div className="mx_RoomSettings_powerLevel">
{ _t('This room is not accessible by remote Matrix servers') }. { _t('This room is not accessible by remote Matrix servers') }.