Add 'send without verifying' to status bar

Fixes other part of https://github.com/vector-im/riot-web/issues/5936
This commit is contained in:
David Baker 2018-01-09 13:52:37 +00:00
parent 76ce40715d
commit 4c101628b5
4 changed files with 34 additions and 14 deletions

View file

@ -24,7 +24,11 @@ import WhoIsTyping from '../../WhoIsTyping';
import MatrixClientPeg from '../../MatrixClientPeg';
import MemberAvatar from '../views/avatars/MemberAvatar';
import Resend from '../../Resend';
import { showUnknownDeviceDialogForMessages } from '../../cryptodevices';
import {
showUnknownDeviceDialogForMessages,
markAllDevicesKnown,
getUnknownDevicesForRoom,
} from '../../cryptodevices';
const STATUS_BAR_HIDDEN = 0;
const STATUS_BAR_EXPANDED = 1;
@ -148,6 +152,13 @@ module.exports = React.createClass({
});
},
_onSendWithoutVerifyingClick: function() {
getUnknownDevicesForRoom(MatrixClientPeg.get(), this.props.room).then((devices) => {
markAllDevicesKnown(MatrixClientPeg.get(), devices);
Resend.resendUnsentEvents(this.props.room);
});
},
_onResendAllClick: function() {
Resend.resendUnsentEvents(this.props.room);
},
@ -289,10 +300,11 @@ module.exports = React.createClass({
if (hasUDE) {
title = _t("Message not sent due to unknown devices being present");
content = _t(
"<showDevicesText>Show devices</showDevicesText> or <cancelText>cancel all</cancelText>.",
"<showDevicesText>Show devices</showDevicesText>, <sendAnywayText>send without verifying</sendAnywayText> or <cancelText>cancel all</cancelText>.",
{},
{
'showDevicesText': (sub) => <a className="mx_RoomStatusBar_resend_link" key="resend" onClick={this._onShowDevicesClick}>{ sub }</a>,
'sendAnywayText': (sub) => <a className="mx_RoomStatusBar_resend_link" key="sendAnyway" onClick={this._onSendWithoutVerifyingClick}>{ sub }</a>,
'cancelText': (sub) => <a className="mx_RoomStatusBar_resend_link" key="cancel" onClick={this._onCancelAllClick}>{ sub }</a>,
},
);