WIP: try to support non-guest room peek. Rename visibility permissions in room settings a bit, and fix how they are persisted.

This commit is contained in:
Matthew Hodgson 2016-01-18 17:39:23 +00:00
parent cc3d27bd4b
commit 491ba94230
4 changed files with 132 additions and 41 deletions

View file

@ -23,33 +23,57 @@ module.exports = React.createClass({
propTypes: {
onJoinClick: React.PropTypes.func,
canJoin: React.PropTypes.bool
onRejectClick: React.PropTypes.func,
inviterName: React.PropTypes.string,
canJoin: React.PropTypes.bool,
canPreview: React.PropTypes.bool,
},
getDefaultProps: function() {
return {
onJoinClick: function() {},
canJoin: false
canJoin: false,
canPreview: true,
};
},
render: function() {
var joinBlock;
var joinBlock, previewBlock;
if (this.props.canJoin) {
if (this.props.inviter) {
joinBlock = (
<div>
<div className="mx_RoomPreviewBar_invite_text">
You have been invited to join this room by { this.props.inviterName }
</div>
<div className="mx_RoomPreviewBar_join_text">
Would you like to <a onClick={ this.props.onJoinClick }>accept</a> or
<a onClick={ this.props.onRejectClick }>decline</a> this invitation?
</div>
</div>
);
}
else if (this.props.canJoin) {
joinBlock = (
<div className="mx_RoomPreviewBar_join_text">
Would you like to <a onClick={this.props.onJoinClick}>join</a> this room?
Would you like to <a onClick={ this.props.onJoinClick }>join</a> this room?
</div>
);
}
if (this.props.canPreview) {
previewBlock = (
<div className="mx_RoomPreviewBar_preview_text">
This is a preview of this room. Room interactions have been disabled.
</div>
);
}
return (
<div className="mx_RoomPreviewBar">
<div className="mx_RoomPreviewBar_preview_text">
This is a preview of this room. Room interactions have been disabled.
</div>
{joinBlock}
{ previewBlock }
{ joinBlock }
</div>
);
}

View file

@ -660,12 +660,13 @@ module.exports = React.createClass({
}
</div>
// FIXME: disable guests_read if the user hasn't turned on shared history
return (
<div className="mx_RoomSettings">
<label><input type="checkbox" ref="is_private" defaultChecked={join_rule != "public"}/> Make this room private</label> <br/>
<label><input type="checkbox" ref="share_history" defaultChecked={history_visibility == "shared"}/> Share message history with new users</label> <br/>
<label><input type="checkbox" ref="guests_read" defaultChecked={history_visibility === "world_readable"}/> Allow guests to read messages in this room</label> <br/>
<label><input type="checkbox" ref="guests_join" defaultChecked={guest_access === "can_join"}/> Allow guests to join this room</label> <br/>
<label><input type="checkbox" ref="share_history" defaultChecked={history_visibility === "shared" || history_visibility === "world_readable"}/> Share message history with new participants</label> <br/>
<label><input type="checkbox" ref="guests_join" defaultChecked={guest_access === "can_join"}/> Let guests join this room</label> <br/>
<label><input type="checkbox" ref="guests_read" defaultChecked={history_visibility === "world_readable"}/> Let users read message history without joining</label> <br/>
<label className="mx_RoomSettings_encrypt"><input type="checkbox" /> Encrypt room</label>
{ tags_section }