Merge pull request #210 from matrix-org/dbkr/invite_display_when_peekable

Show the invite preview bar when we have a 3pid invite
This commit is contained in:
David Baker 2016-03-11 10:21:04 +00:00
commit 1516f17af4
2 changed files with 20 additions and 0 deletions

View file

@ -883,6 +883,16 @@ module.exports = React.createClass({
}); });
}, },
onRejectThreepidInviteButtonClicked: function(ev) {
// We can reject 3pid invites in the same way that we accept them,
// using /leave rather than /join. In the short term though, we
// just ignore them.
// https://github.com/vector-im/vector-web/issues/1134
dis.dispatch({
action: 'view_room_directory',
});
},
onSearchClick: function() { onSearchClick: function() {
this.setState({ searching: true }); this.setState({ searching: true });
}, },
@ -1089,6 +1099,7 @@ module.exports = React.createClass({
<RoomHeader ref="header" room={this.state.room} oobData={this.props.oobData} /> <RoomHeader ref="header" room={this.state.room} oobData={this.props.oobData} />
<div className="mx_RoomView_auxPanel"> <div className="mx_RoomView_auxPanel">
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked } <RoomPreviewBar onJoinClick={ this.onJoinButtonClicked }
onRejectClick={ this.onRejectThreepidInviteButtonClicked }
canJoin={ true } canPreview={ false } canJoin={ true } canPreview={ false }
spinner={this.state.joining} spinner={this.state.joining}
inviterName={inviterName} inviterName={inviterName}
@ -1195,9 +1206,15 @@ module.exports = React.createClass({
} }
else if (this.state.guestsCanJoin && MatrixClientPeg.get().isGuest() && else if (this.state.guestsCanJoin && MatrixClientPeg.get().isGuest() &&
(!myMember || myMember.membership !== "join")) { (!myMember || myMember.membership !== "join")) {
var inviterName = undefined;
if (this.props.oobData) {
inviterName = this.props.oobData.inviterName;
}
aux = ( aux = (
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true} <RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true}
onRejectClick={ this.onRejectThreepidInviteButtonClicked }
spinner={this.state.joining} spinner={this.state.joining}
inviterName={inviterName}
/> />
); );
} }

View file

@ -25,6 +25,9 @@ module.exports = React.createClass({
propTypes: { propTypes: {
onJoinClick: React.PropTypes.func, onJoinClick: React.PropTypes.func,
onRejectClick: React.PropTypes.func, onRejectClick: React.PropTypes.func,
// if inviterName is specified, the preview bar will shown an invite to the room.
// You should also specify onRejectClick if specifiying inviterName
inviterName: React.PropTypes.string, inviterName: React.PropTypes.string,
canJoin: React.PropTypes.bool, canJoin: React.PropTypes.bool,
canPreview: React.PropTypes.bool, canPreview: React.PropTypes.bool,