mirror of https://github.com/vector-im/riot-web
set dialog title for self-verification
use request.isSelfVerification helperpull/21833/head
parent
009941a6ac
commit
081baa2359
|
@ -30,16 +30,29 @@ export default class VerificationRequestDialog extends React.Component {
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
super(...args);
|
super(...args);
|
||||||
this.onFinished = this.onFinished.bind(this);
|
this.onFinished = this.onFinished.bind(this);
|
||||||
|
this.state = {};
|
||||||
|
if (this.props.verificationRequest) {
|
||||||
|
this.state.verificationRequest = this.props.verificationRequest;
|
||||||
|
} else if (this.props.verificationRequestPromise) {
|
||||||
|
this.props.verificationRequestPromise.then(r => {
|
||||||
|
this.setState({verificationRequest: r});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const BaseDialog = sdk.getComponent("views.dialogs.BaseDialog");
|
const BaseDialog = sdk.getComponent("views.dialogs.BaseDialog");
|
||||||
const EncryptionPanel = sdk.getComponent("views.right_panel.EncryptionPanel");
|
const EncryptionPanel = sdk.getComponent("views.right_panel.EncryptionPanel");
|
||||||
|
const request = this.state.verificationRequest;
|
||||||
|
const otherUserId = request && request.otherUserId;
|
||||||
const member = this.props.member ||
|
const member = this.props.member ||
|
||||||
MatrixClientPeg.get().getUser(this.props.verificationRequest.otherUserId);
|
otherUserId && MatrixClientPeg.get().getUser(otherUserId);
|
||||||
|
const title = request && request.isSelfVerification ?
|
||||||
|
_t("Verify this session") : _t("Verification Request");
|
||||||
|
|
||||||
return <BaseDialog className="mx_InfoDialog" onFinished={this.onFinished}
|
return <BaseDialog className="mx_InfoDialog" onFinished={this.onFinished}
|
||||||
contentId="mx_Dialog_content"
|
contentId="mx_Dialog_content"
|
||||||
title={_t("Verification Request")}
|
title={title}
|
||||||
hasCancel={true}
|
hasCancel={true}
|
||||||
>
|
>
|
||||||
<EncryptionPanel
|
<EncryptionPanel
|
||||||
|
|
|
@ -155,12 +155,8 @@ export default class VerificationPanel extends React.PureComponent {
|
||||||
this.state.reciprocateQREvent.cancel();
|
this.state.reciprocateQREvent.cancel();
|
||||||
};
|
};
|
||||||
|
|
||||||
get _isSelfVerification() {
|
|
||||||
return this.props.request.otherUserId === MatrixClientPeg.get().getUserId();
|
|
||||||
}
|
|
||||||
|
|
||||||
renderQRReciprocatePhase() {
|
renderQRReciprocatePhase() {
|
||||||
const {member} = this.props;
|
const {member, request} = this.props;
|
||||||
let Button;
|
let Button;
|
||||||
// a bit of a hack, but the FormButton should only be used in the right panel
|
// a bit of a hack, but the FormButton should only be used in the right panel
|
||||||
// they should probably just be the same component with a css class applied to it?
|
// they should probably just be the same component with a css class applied to it?
|
||||||
|
@ -169,7 +165,7 @@ export default class VerificationPanel extends React.PureComponent {
|
||||||
} else {
|
} else {
|
||||||
Button = sdk.getComponent("elements.FormButton");
|
Button = sdk.getComponent("elements.FormButton");
|
||||||
}
|
}
|
||||||
const description = this._isSelfVerification ?
|
const description = request.isSelfVerification ?
|
||||||
_t("Almost there! Is your other session showing the same shield?") :
|
_t("Almost there! Is your other session showing the same shield?") :
|
||||||
_t("Almost there! Is %(displayName)s showing the same shield?", {
|
_t("Almost there! Is %(displayName)s showing the same shield?", {
|
||||||
displayName: member.displayName || member.name || member.userId,
|
displayName: member.displayName || member.name || member.userId,
|
||||||
|
|
Loading…
Reference in New Issue