Fix URL preview options

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-10-30 19:49:44 -06:00
parent 72517f95bb
commit 9c846e4dd9
4 changed files with 19 additions and 4 deletions

View file

@ -26,6 +26,7 @@ module.exports = React.createClass({
roomId: React.PropTypes.string, // for per-room settings
label: React.PropTypes.string, // untranslated
onChange: React.PropTypes.func,
isExplicit: React.PropTypes.bool,
// If group is supplied, then this will create a radio button instead.
group: React.PropTypes.string,
@ -41,7 +42,8 @@ module.exports = React.createClass({
},
render: function() {
let val = SettingsStore.getValueAt(this.props.level, this.props.name, this.props.roomId);
const val = SettingsStore.getValueAt(this.props.level, this.props.name, this.props.roomId, this.props.isExplicit);
const canChange = SettingsStore.canSetValue(this.props.name, this.props.roomId, this.props.level);
let label = this.props.label;
if (!label) label = SettingsStore.getDisplayName(this.props.name, this.props.level);
@ -54,6 +56,7 @@ module.exports = React.createClass({
type="checkbox"
defaultChecked={val}
onChange={this.onChange}
disabled={!canChange}
/>
);
if (this.props.group) {
@ -64,6 +67,7 @@ module.exports = React.createClass({
value={this.props.value}
checked={val === this.props.value}
onChange={this.onChange}
disabled={!canChange}
/>
);
}

View file

@ -55,7 +55,8 @@ module.exports = React.createClass({
<label>
<SettingsCheckbox name="urlPreviewsEnabled"
level="room"
roomId={this.props.room.roomId} />
roomId={this.props.room.roomId}
isExplicit={true} />
</label>
);
} else {