adjust self-verification copy in incoming verif req toast
This commit is contained in:
parent
cdbd4da0e4
commit
364421b088
2 changed files with 26 additions and 11 deletions
|
@ -1521,7 +1521,7 @@ export default createReactClass({
|
|||
} else if (request.pending) {
|
||||
ToastStore.sharedInstance().addOrReplaceToast({
|
||||
key: 'verifreq_' + request.channel.transactionId,
|
||||
title: _t("Verification Request"),
|
||||
title: request.isSelfVerification ? _t("Self-verification request") : _t("Verification Request"),
|
||||
icon: "verification",
|
||||
props: {request},
|
||||
component: sdk.getComponent("toasts.VerificationRequestToast"),
|
||||
|
|
|
@ -31,7 +31,7 @@ export default class VerificationRequestToast extends React.PureComponent {
|
|||
this.state = {counter: Math.ceil(props.request.timeout / 1000)};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
async componentDidMount() {
|
||||
const {request} = this.props;
|
||||
if (request.timeout && request.timeout > 0) {
|
||||
this._intervalHandle = setInterval(() => {
|
||||
|
@ -48,6 +48,11 @@ export default class VerificationRequestToast extends React.PureComponent {
|
|||
// As a quick & dirty fix, check the toast is still relevant when it mounts (this prevents
|
||||
// a toast hanging around after logging in if you did a verification as part of login).
|
||||
this._checkRequestIsPending();
|
||||
|
||||
if (request.isSelfVerification) {
|
||||
const cli = MatrixClientPeg.get();
|
||||
this.setState({device: await cli.getStoredDevice(cli.getUserId(), request.channel.deviceId)});
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
@ -107,9 +112,18 @@ export default class VerificationRequestToast extends React.PureComponent {
|
|||
render() {
|
||||
const FormButton = sdk.getComponent("elements.FormButton");
|
||||
const {request} = this.props;
|
||||
let nameLabel;
|
||||
if (request.isSelfVerification) {
|
||||
if (this.state.device) {
|
||||
nameLabel = _t("From %(deviceName)s (%(deviceId)s)", {
|
||||
deviceName: this.state.device.getDisplayName(),
|
||||
deviceId: this.state.device.deviceId,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const userId = request.otherUserId;
|
||||
const roomId = request.channel.roomId;
|
||||
let nameLabel = roomId ? userLabelForEventRoom(userId, roomId) : userId;
|
||||
nameLabel = roomId ? userLabelForEventRoom(userId, roomId) : userId;
|
||||
// for legacy to_device verification requests
|
||||
if (nameLabel === userId) {
|
||||
const client = MatrixClientPeg.get();
|
||||
|
@ -118,6 +132,7 @@ export default class VerificationRequestToast extends React.PureComponent {
|
|||
nameLabel = _t("%(name)s (%(userId)s)", {name: user.displayName, userId});
|
||||
}
|
||||
}
|
||||
}
|
||||
const declineLabel = this.state.counter == 0 ?
|
||||
_t("Decline") :
|
||||
_t("Decline (%(counter)s)", {counter: this.state.counter});
|
||||
|
|
Loading…
Reference in a new issue