From 244b613623660ecf5ac3ebda66fd140126d50cba Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 29 Jul 2019 15:04:18 +0100 Subject: [PATCH] Convert 3PID lookup in preview bar to async / await --- src/components/views/rooms/RoomPreviewBar.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index ed91c5aafc..db5d16c8cb 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -104,21 +104,21 @@ module.exports = React.createClass({ } }, - _checkInvitedEmail: function() { + _checkInvitedEmail: async 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 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) => { + try { + const result = await MatrixClientPeg.get().lookupThreePid( + 'email', this.props.invitedEmail, + ); this.setState({invitedEmailMxid: result.mxid}); - }, (err) => { + } catch (err) { this.setState({threePidFetchError: err}); - }); + } + this.setState({busy: false}); } },