Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3074 from matrix-org/dbkr/fix_email_invite_addres…
Browse files Browse the repository at this point in the history
…s_match_check

Fix email invites address-match checking
  • Loading branch information
dbkr authored Jun 6, 2019
2 parents aec3950 + 9816fe0 commit b365c9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ module.exports = React.createClass({
joining={this.state.joining}
inviterName={inviterName}
invitedEmail={invitedEmail}
oobData={this.props.oobData}
room={this.state.room}
/>
</div>
Expand Down Expand Up @@ -1681,6 +1682,7 @@ module.exports = React.createClass({
joining={this.state.joining}
inviterName={inviterName}
invitedEmail={invitedEmail}
oobData={this.props.oobData}
canPreview={this.state.canPeek}
room={this.state.room}
/>
Expand Down
15 changes: 14 additions & 1 deletion src/components/views/rooms/RoomPreviewBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ module.exports = React.createClass({
// If invited by 3rd party invite, the email address the invite was sent to
invitedEmail: PropTypes.string,

// For third party invites, information passed about the room out-of-band
oobData: PropTypes.object,

// A standard client/server API error object. If supplied, indicates that the
// caller was unable to fetch details about the room for the given reason.
error: PropTypes.object,
Expand Down Expand Up @@ -87,6 +90,16 @@ module.exports = React.createClass({
},

componentWillMount: function() {
this._checkInvitedEmail();
},

componentDidUpdate: function(prevProps, prevState) {
if (this.props.invitedEmail !== prevProps.invitedEmail || this.props.inviterName !== prevProps.inviterName) {
this._checkInvitedEmail();
}
},

_checkInvitedEmail: function() {
// If this is an invite and we've been told what email
// address was invited, fetch the user's list of Threepids
// so we can check them against the one that was invited
Expand Down Expand Up @@ -335,7 +348,7 @@ module.exports = React.createClass({
}
case MessageCase.Invite: {
const RoomAvatar = sdk.getComponent("views.avatars.RoomAvatar");
const avatar = <RoomAvatar room={this.props.room} />;
const avatar = <RoomAvatar room={this.props.room} oobData={this.props.oobData} />;

const inviteMember = this._getInviteMember();
let inviterElement;
Expand Down

0 comments on commit b365c9d

Please sign in to comment.