diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index 5990a98e47..cec02291b7 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -18,6 +18,7 @@ limitations under the License. var React = require('react'); var sdk = require('../../../index'); +var MatrixClientPeg = require('../../../MatrixClientPeg'); module.exports = React.createClass({ displayName: 'RoomPreviewBar', @@ -45,10 +46,34 @@ module.exports = React.createClass({ }; }, + getInitialState: function() { + return { + busy: false + } + }, + + componentWillMount: function() { + // If this is an invite and we've been told what email + // address was invited, fetch the user's list of 3pids + // so we can check them against the one that was invited + if (this.props.inviterName && this.props.invitedEmail) { + this.setState({busy: true}); + MatrixClientPeg.get().lookupThreePid( + 'email', this.props.invitedEmail + ).finally(() => { + this.setState({busy: false}); + }).done((result) => { + this.setState({invitedEmailMxid: result.mxid}); + }, (err) => { + this.setState({threePidFetchError: err}); + }); + } + }, + render: function() { var joinBlock, previewBlock; - if (this.props.spinner) { + if (this.props.spinner || this.state.busy) { var Spinner = sdk.getComponent("elements.Spinner"); return (