implement history visibilty warnings

This commit is contained in:
Matthew Hodgson 2016-03-19 22:32:44 +00:00
parent 7712582c29
commit 68a391e24b

View file

@ -228,9 +228,28 @@ module.exports = React.createClass({
}, },
_onHistoryRadioToggle: function(ev) { _onHistoryRadioToggle: function(ev) {
this.setState({ var self = this;
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
// cancel the click unless the user confirms it
ev.preventDefault();
Modal.createDialog(QuestionDialog, {
title: "Privacy warning",
description:
<div>
Changes to who can read history will only apply to future messages in this room.<br/>
The visibility of existing history will be unchanged.
</div>,
button: "Continue",
onFinished: function(confirmed) {
if (confirmed) {
self.setState({
history_visibility: ev.target.value history_visibility: ev.target.value
}); });
}
},
});
}, },
_onToggle: function(keyName, checkedValue, uncheckedValue, ev) { _onToggle: function(keyName, checkedValue, uncheckedValue, ev) {
@ -438,28 +457,28 @@ module.exports = React.createClass({
<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={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) } disabled={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) }
defaultChecked={historyVisibility === "world_readable"} checked={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={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) } disabled={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) }
defaultChecked={historyVisibility === "shared"} checked={historyVisibility === "shared"}
onChange={this._onHistoryRadioToggle} /> onChange={this._onHistoryRadioToggle} />
Members only (since the point in time of selecting this option) Members only (since the point in time of selecting this option)
</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={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) } disabled={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) }
defaultChecked={historyVisibility === "invited"} checked={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={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) } disabled={ !roomState.mayClientSendStateEvent("m.room.history_visibility", cli) }
defaultChecked={historyVisibility === "joined"} checked={historyVisibility === "joined"}
onChange={this._onHistoryRadioToggle} /> onChange={this._onHistoryRadioToggle} />
Members only (since they joined) Members only (since they joined)
</label> </label>