Support IS v2 auth in preview bar

pull/21833/head
J. Ryan Stinnett 2019-07-29 15:08:54 +01:00
parent 244b613623
commit dacb5d42ac
2 changed files with 13 additions and 2 deletions

View File

@ -520,7 +520,12 @@ module.exports = React.createClass({
const isAccessToken = await authClient.getAccessToken(); const isAccessToken = await authClient.getAccessToken();
if (cancelled) return null; if (cancelled) return null;
const lookup = await MatrixClientPeg.get().lookupThreePid(medium, address, undefined, isAccessToken); const lookup = await MatrixClientPeg.get().lookupThreePid(
medium,
address,
undefined /* callback */,
isAccessToken,
);
if (cancelled || lookup === null || !lookup.mxid) return null; if (cancelled || lookup === null || !lookup.mxid) return null;
const profile = await MatrixClientPeg.get().getProfileInfo(lookup.mxid); const profile = await MatrixClientPeg.get().getProfileInfo(lookup.mxid);

View File

@ -25,6 +25,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg';
import dis from '../../../dispatcher'; import dis from '../../../dispatcher';
import classNames from 'classnames'; import classNames from 'classnames';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import IdentityAuthClient from '../../../IdentityAuthClient';
const MessageCase = Object.freeze({ const MessageCase = Object.freeze({
NotLoggedIn: "NotLoggedIn", NotLoggedIn: "NotLoggedIn",
@ -111,8 +112,13 @@ module.exports = React.createClass({
if (this.props.inviterName && this.props.invitedEmail) { if (this.props.inviterName && this.props.invitedEmail) {
this.setState({busy: true}); this.setState({busy: true});
try { try {
const authClient = new IdentityAuthClient();
const isAccessToken = await authClient.getAccessToken();
const result = await MatrixClientPeg.get().lookupThreePid( const result = await MatrixClientPeg.get().lookupThreePid(
'email', this.props.invitedEmail, 'email',
this.props.invitedEmail,
undefined /* callback */,
isAccessToken,
); );
this.setState({invitedEmailMxid: result.mxid}); this.setState({invitedEmailMxid: result.mxid});
} catch (err) { } catch (err) {