oops, use right signature for roomState.maySendStateEvent

This commit is contained in:
Matthew Hodgson 2016-03-16 12:17:07 +00:00
parent 014ea9a328
commit 4db79edb73

View file

@ -273,6 +273,7 @@ module.exports = React.createClass({
var power_levels = this.props.room.currentState.getStateEvents('m.room.power_levels', ''); var power_levels = this.props.room.currentState.getStateEvents('m.room.power_levels', '');
var events_levels = (power_levels ? power_levels.events : {}) || {}; var events_levels = (power_levels ? power_levels.events : {}) || {};
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
var roomState = this.props.room.currentState;
var user_id = cli.credentials.userId; var user_id = cli.credentials.userId;
if (power_levels) { if (power_levels) {
@ -421,13 +422,13 @@ module.exports = React.createClass({
Mute notifications for this room Mute notifications for this room
</label> </label>
<label> <label>
<input type="checkbox" disabled={ !cli.maySendStateEvent("m.room.join_rule") } <input type="checkbox" disabled={ !roomState.maySendStateEvent("m.room.join_rule", user_id) }
onChange={this._onToggle.bind(this, "join_rule", "invite", "public")} onChange={this._onToggle.bind(this, "join_rule", "invite", "public")}
defaultChecked={this.state.join_rule !== "public"}/> defaultChecked={this.state.join_rule !== "public"}/>
Make this room private Make this room private
</label> </label>
<label> <label>
<input type="checkbox" disabled={ !cli.maySendStateEvent("m.room.guest_access") } <input type="checkbox" disabled={ !roomState.maySendStateEvent("m.room.guest_access", user_id) }
onChange={this._onToggle.bind(this, "guest_access", "can_join", "forbidden")} onChange={this._onToggle.bind(this, "guest_access", "can_join", "forbidden")}
defaultChecked={this.state.guest_access === "can_join"}/> defaultChecked={this.state.guest_access === "can_join"}/>
Let guests join this room Let guests join this room
@ -436,28 +437,28 @@ module.exports = React.createClass({
<h3>Who can read history?</h3> <h3>Who can read history?</h3>
<label htmlFor="hvis_wr"> <label htmlFor="hvis_wr">
<input type="radio" id="hvis_wr" name="historyVis" value="world_readable" <input type="radio" id="hvis_wr" name="historyVis" value="world_readable"
disabled={ !cli.maySendStateEvent("m.room.history_visibility") } disabled={ !roomState.maySendStateEvent("m.room.history_visibility", user_id) }
defaultChecked={historyVisibility === "world_readable"} defaultChecked={historyVisibility === "world_readable"}
onChange={this._onHistoryRadioToggle} /> onChange={this._onHistoryRadioToggle} />
Anyone Anyone
</label> </label>
<label htmlFor="hvis_sh"> <label htmlFor="hvis_sh">
<input type="radio" id="hvis_sh" name="historyVis" value="shared" <input type="radio" id="hvis_sh" name="historyVis" value="shared"
disabled={ !cli.maySendStateEvent("m.room.history_visibility") } disabled={ !roomState.maySendStateEvent("m.room.history_visibility", user_id) }
defaultChecked={historyVisibility === "shared"} defaultChecked={historyVisibility === "shared"}
onChange={this._onHistoryRadioToggle} /> onChange={this._onHistoryRadioToggle} />
Members only (since the room began) Members only (since the room began)
</label> </label>
<label htmlFor="hvis_inv"> <label htmlFor="hvis_inv">
<input type="radio" id="hvis_inv" name="historyVis" value="invited" <input type="radio" id="hvis_inv" name="historyVis" value="invited"
disabled={ !cli.maySendStateEvent("m.room.history_visibility") } disabled={ !roomState.maySendStateEvent("m.room.history_visibility", user_id) }
defaultChecked={historyVisibility === "invited"} defaultChecked={historyVisibility === "invited"}
onChange={this._onHistoryRadioToggle} /> onChange={this._onHistoryRadioToggle} />
Members only (since they were invited) Members only (since they were invited)
</label> </label>
<label htmlFor="hvis_joi"> <label htmlFor="hvis_joi">
<input type="radio" id="hvis_joi" name="historyVis" value="joined" <input type="radio" id="hvis_joi" name="historyVis" value="joined"
disabled={ !cli.maySendStateEvent("m.room.history_visibility") } disabled={ !roomState.maySendStateEvent("m.room.history_visibility", user_id) }
defaultChecked={historyVisibility === "joined"} defaultChecked={historyVisibility === "joined"}
onChange={this._onHistoryRadioToggle} /> onChange={this._onHistoryRadioToggle} />
Members only (since they joined) Members only (since they joined)
@ -477,8 +478,8 @@ module.exports = React.createClass({
<AliasSettings ref="alias_settings" <AliasSettings ref="alias_settings"
roomId={this.props.room.roomId} roomId={this.props.room.roomId}
canSetCanonicalAlias={ cli.maySendStateEvent("m.room.canonical_alias") } canSetCanonicalAlias={ roomState.maySendStateEvent("m.room.canonical_alias", user_id) }
canSetAliases={ cli.maySendStateEvent("m.room.aliases") } canSetAliases={ roomState.maySendStateEvent("m.room.aliases", user_id) }
canonicalAliasEvent={this.props.room.currentState.getStateEvents('m.room.canonical_alias', '')} canonicalAliasEvent={this.props.room.currentState.getStateEvents('m.room.canonical_alias', '')}
aliasEvents={this.props.room.currentState.getStateEvents('m.room.aliases')} /> aliasEvents={this.props.room.currentState.getStateEvents('m.room.aliases')} />