WIP on fixing https://github.com/vector-im/vector-web/issues/924
Pass the invited email through to RoomPreviewBar, display it in a temporary way currently. Remove a condition from RoomView render that appears to be functionally identical to the previous.
This commit is contained in:
parent
a13513935b
commit
f1844a99e7
3 changed files with 47 additions and 22 deletions
|
@ -390,7 +390,7 @@ module.exports = React.createClass({
|
||||||
case 'view_room':
|
case 'view_room':
|
||||||
this._viewRoom(
|
this._viewRoom(
|
||||||
payload.room_id, payload.room_alias, payload.show_settings, payload.event_id,
|
payload.room_id, payload.room_alias, payload.show_settings, payload.event_id,
|
||||||
payload.invite_sign_url, payload.oob_data
|
payload.third_party_invite, payload.oob_data
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'view_prev_room':
|
case 'view_prev_room':
|
||||||
|
@ -437,7 +437,7 @@ module.exports = React.createClass({
|
||||||
room_id: foundRoom.roomId,
|
room_id: foundRoom.roomId,
|
||||||
room_alias: payload.room_alias,
|
room_alias: payload.room_alias,
|
||||||
event_id: payload.event_id,
|
event_id: payload.event_id,
|
||||||
invite_sign_url: payload.invite_sign_url,
|
third_party_invite: payload.third_party_invite,
|
||||||
oob_data: payload.oob_data,
|
oob_data: payload.oob_data,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -450,7 +450,7 @@ module.exports = React.createClass({
|
||||||
room_id: result.room_id,
|
room_id: result.room_id,
|
||||||
room_alias: payload.room_alias,
|
room_alias: payload.room_alias,
|
||||||
event_id: payload.event_id,
|
event_id: payload.event_id,
|
||||||
invite_sign_url: payload.invite_sign_url,
|
third_party_invite: payload.third_party_invite,
|
||||||
oob_data: payload.oob_data,
|
oob_data: payload.oob_data,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -539,10 +539,14 @@ module.exports = React.createClass({
|
||||||
//
|
//
|
||||||
// eventId is optional and will cause a switch to the context of that
|
// eventId is optional and will cause a switch to the context of that
|
||||||
// particular event.
|
// particular event.
|
||||||
|
// @param {Object} thirdPartyInvite Object containing data about the third party
|
||||||
|
// we received to join the room, if any.
|
||||||
|
// @param {Object} thirdPartyInvite.inviteSignUrl 3pid invite sign URL
|
||||||
|
// @param {Object} thirdPartyInvite.invitedwithEmail The email address the invite was sent to
|
||||||
// @param {Object} oob_data Object of additional data about the room
|
// @param {Object} oob_data Object of additional data about the room
|
||||||
// that has been passed out-of-band (eg.
|
// that has been passed out-of-band (eg.
|
||||||
// room name and avatar from an invite email)
|
// room name and avatar from an invite email)
|
||||||
_viewRoom: function(roomId, roomAlias, showSettings, eventId, invite_sign_url, oob_data) {
|
_viewRoom: function(roomId, roomAlias, showSettings, eventId, thirdPartyInvite, oob_data) {
|
||||||
// before we switch room, record the scroll state of the current room
|
// before we switch room, record the scroll state of the current room
|
||||||
this._updateScrollMap();
|
this._updateScrollMap();
|
||||||
|
|
||||||
|
@ -555,7 +559,7 @@ module.exports = React.createClass({
|
||||||
highlightedEventId: eventId,
|
highlightedEventId: eventId,
|
||||||
initialEventPixelOffset: undefined,
|
initialEventPixelOffset: undefined,
|
||||||
page_type: this.PageTypes.RoomView,
|
page_type: this.PageTypes.RoomView,
|
||||||
inviteSignUrl: invite_sign_url,
|
thirdPartyInvite: thirdPartyInvite,
|
||||||
roomOobData: oob_data,
|
roomOobData: oob_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -783,6 +787,11 @@ module.exports = React.createClass({
|
||||||
var roomString = segments[0];
|
var roomString = segments[0];
|
||||||
var eventId = segments[1]; // undefined if no event id given
|
var eventId = segments[1]; // undefined if no event id given
|
||||||
|
|
||||||
|
// FIXME: sort_out caseConsistency
|
||||||
|
var third_party_invite = {
|
||||||
|
inviteSignUrl: params.signurl,
|
||||||
|
invitedEmail: params.email,
|
||||||
|
};
|
||||||
var oob_data = {
|
var oob_data = {
|
||||||
name: params.room_name,
|
name: params.room_name,
|
||||||
avatarUrl: params.room_avatar_url,
|
avatarUrl: params.room_avatar_url,
|
||||||
|
@ -794,7 +803,7 @@ module.exports = React.createClass({
|
||||||
action: 'view_room_alias',
|
action: 'view_room_alias',
|
||||||
room_alias: roomString,
|
room_alias: roomString,
|
||||||
event_id: eventId,
|
event_id: eventId,
|
||||||
invite_sign_url: params.signurl,
|
third_party_invite: third_party_invite,
|
||||||
oob_data: oob_data,
|
oob_data: oob_data,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -802,7 +811,7 @@ module.exports = React.createClass({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: roomString,
|
room_id: roomString,
|
||||||
event_id: eventId,
|
event_id: eventId,
|
||||||
invite_sign_url: params.signurl,
|
third_party_invite: third_party_invite,
|
||||||
oob_data: oob_data,
|
oob_data: oob_data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1009,7 +1018,7 @@ module.exports = React.createClass({
|
||||||
roomId={this.state.currentRoom}
|
roomId={this.state.currentRoom}
|
||||||
roomAlias={this.state.currentRoomAlias}
|
roomAlias={this.state.currentRoomAlias}
|
||||||
eventId={this.state.initialEventId}
|
eventId={this.state.initialEventId}
|
||||||
inviteSignUrl={this.state.inviteSignUrl}
|
thirdPartyInvite={this.state.thirdPartyInvite}
|
||||||
oobData={this.state.roomOobData}
|
oobData={this.state.roomOobData}
|
||||||
highlightedEventId={this.state.highlightedEventId}
|
highlightedEventId={this.state.highlightedEventId}
|
||||||
eventPixelOffset={this.state.initialEventPixelOffset}
|
eventPixelOffset={this.state.initialEventPixelOffset}
|
||||||
|
|
|
@ -60,9 +60,12 @@ module.exports = React.createClass({
|
||||||
// useful for joining rooms by alias correctly (and fixing https://github.com/vector-im/vector-web/issues/819)
|
// useful for joining rooms by alias correctly (and fixing https://github.com/vector-im/vector-web/issues/819)
|
||||||
roomAlias: React.PropTypes.string,
|
roomAlias: React.PropTypes.string,
|
||||||
|
|
||||||
// The URL used to join this room from an email invite
|
// An object representing a third party invite to join this room
|
||||||
// (given as part of the link in the invite email)
|
// Fields:
|
||||||
inviteSignUrl: React.PropTypes.string,
|
// * inviteSignUrl (string) The URL used to join this room from an email invite
|
||||||
|
// (given as part of the link in the invite email)
|
||||||
|
// * invitedEmail (string) The email address that was invited to this room
|
||||||
|
thirdPartyInvite: React.PropTypes.object,
|
||||||
|
|
||||||
// Any data about the room that would normally come from the Home Server
|
// Any data about the room that would normally come from the Home Server
|
||||||
// but has been passed out-of-band, eg. the room name and avatar URL
|
// but has been passed out-of-band, eg. the room name and avatar URL
|
||||||
|
@ -538,8 +541,9 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
display_name_promise.then(() => {
|
display_name_promise.then(() => {
|
||||||
|
var sign_url = this.props.thirdPartyInvite ? this.props.thirdPartyInvite.inviteSignUrl : undefined;
|
||||||
return MatrixClientPeg.get().joinRoom(this.props.roomAlias || this.props.roomId,
|
return MatrixClientPeg.get().joinRoom(this.props.roomAlias || this.props.roomId,
|
||||||
{ inviteSignUrl: this.props.inviteSignUrl } )
|
{ inviteSignUrl: sign_url } )
|
||||||
}).done(function() {
|
}).done(function() {
|
||||||
// It is possible that there is no Room yet if state hasn't come down
|
// It is possible that there is no Room yet if state hasn't come down
|
||||||
// from /sync - joinRoom will resolve when the HTTP request to join succeeds,
|
// from /sync - joinRoom will resolve when the HTTP request to join succeeds,
|
||||||
|
@ -1097,7 +1101,13 @@ module.exports = React.createClass({
|
||||||
if (this.props.oobData) {
|
if (this.props.oobData) {
|
||||||
inviterName = this.props.oobData.inviterName;
|
inviterName = this.props.oobData.inviterName;
|
||||||
}
|
}
|
||||||
|
var invitedEmail = undefined;
|
||||||
|
if (this.props.thirdPartyInvite) {
|
||||||
|
invitedEmail = this.props.thirdPartyInvite.invitedEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have no room object for this room, only the ID.
|
||||||
|
// We've got to this room by following a link, possibly a third party invite.
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<RoomHeader ref="header" room={this.state.room} oobData={this.props.oobData} />
|
<RoomHeader ref="header" room={this.state.room} oobData={this.props.oobData} />
|
||||||
|
@ -1107,6 +1117,7 @@ module.exports = React.createClass({
|
||||||
canJoin={ true } canPreview={ false }
|
canJoin={ true } canPreview={ false }
|
||||||
spinner={this.state.joining}
|
spinner={this.state.joining}
|
||||||
inviterName={inviterName}
|
inviterName={inviterName}
|
||||||
|
invitedEmail={invitedEmail}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_RoomView_messagePanel"></div>
|
<div className="mx_RoomView_messagePanel"></div>
|
||||||
|
@ -1138,6 +1149,7 @@ module.exports = React.createClass({
|
||||||
// as they could be a spam vector.
|
// as they could be a spam vector.
|
||||||
// XXX: in future we could give the option of a 'Preview' button which lets them view anyway.
|
// XXX: in future we could give the option of a 'Preview' button which lets them view anyway.
|
||||||
|
|
||||||
|
// We have a regular invite for this room.
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<RoomHeader ref="header" room={this.state.room}/>
|
<RoomHeader ref="header" room={this.state.room}/>
|
||||||
|
@ -1208,24 +1220,24 @@ module.exports = React.createClass({
|
||||||
else if (this.state.searching) {
|
else if (this.state.searching) {
|
||||||
aux = <SearchBar ref="search_bar" searchInProgress={this.state.searchInProgress } onCancelClick={this.onCancelSearchClick} onSearch={this.onSearch}/>;
|
aux = <SearchBar ref="search_bar" searchInProgress={this.state.searchInProgress } onCancelClick={this.onCancelSearchClick} onSearch={this.onSearch}/>;
|
||||||
}
|
}
|
||||||
else if (this.state.guestsCanJoin && MatrixClientPeg.get().isGuest() &&
|
else if (!myMember || myMember.membership !== "join") {
|
||||||
(!myMember || myMember.membership !== "join")) {
|
|
||||||
var inviterName = undefined;
|
var inviterName = undefined;
|
||||||
if (this.props.oobData) {
|
if (this.props.oobData) {
|
||||||
inviterName = this.props.oobData.inviterName;
|
inviterName = this.props.oobData.inviterName;
|
||||||
}
|
}
|
||||||
|
var invitedEmail = undefined;
|
||||||
|
if (this.props.thirdPartyInvite) {
|
||||||
|
invitedEmail = this.props.thirdPartyInvite.invitedEmail;
|
||||||
|
}
|
||||||
|
// We do have a room object for this room, but we're not currently in it.
|
||||||
|
// We may have a 3rd party invite to it.
|
||||||
aux = (
|
aux = (
|
||||||
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true}
|
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true}
|
||||||
onRejectClick={ this.onRejectThreepidInviteButtonClicked }
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
||||||
spinner={this.state.joining}
|
spinner={this.state.joining}
|
||||||
inviterName={inviterName}
|
inviterName={inviterName}
|
||||||
/>
|
invitedEmail={invitedEmail}
|
||||||
);
|
canPreview={this.state.canPeek}
|
||||||
}
|
|
||||||
else if (!myMember || myMember.membership !== "join") {
|
|
||||||
aux = (
|
|
||||||
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true}
|
|
||||||
spinner={this.state.joining} canPreview={ this.state.canPeek }
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@ module.exports = React.createClass({
|
||||||
// if inviterName is specified, the preview bar will shown an invite to the room.
|
// if inviterName is specified, the preview bar will shown an invite to the room.
|
||||||
// You should also specify onRejectClick if specifiying inviterName
|
// You should also specify onRejectClick if specifiying inviterName
|
||||||
inviterName: React.PropTypes.string,
|
inviterName: React.PropTypes.string,
|
||||||
|
|
||||||
|
// If invited by 3rd party invite, the email address the invite was sent to
|
||||||
|
invitedEmail: React.PropTypes.string,
|
||||||
canJoin: React.PropTypes.bool,
|
canJoin: React.PropTypes.bool,
|
||||||
canPreview: React.PropTypes.bool,
|
canPreview: React.PropTypes.bool,
|
||||||
spinner: React.PropTypes.bool,
|
spinner: React.PropTypes.bool,
|
||||||
|
@ -61,6 +64,7 @@ module.exports = React.createClass({
|
||||||
<div className="mx_RoomPreviewBar_join_text">
|
<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?
|
Would you like to <a onClick={ this.props.onJoinClick }>accept</a> or <a onClick={ this.props.onRejectClick }>decline</a> this invitation?
|
||||||
</div>
|
</div>
|
||||||
|
<div>{this.props.invitedEmail} was invited</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue