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:
parent
76ce40715d
commit
4c101628b5
4 changed files with 34 additions and 14 deletions
|
@ -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>,
|
||||
},
|
||||
);
|
||||
|
|
|
@ -23,14 +23,7 @@ import GeminiScrollbar from 'react-gemini-scrollbar';
|
|||
import Resend from '../../../Resend';
|
||||
import { _t } from '../../../languageHandler';
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
|
||||
function markAllDevicesKnown(devices) {
|
||||
Object.keys(devices).forEach((userId) => {
|
||||
Object.keys(devices[userId]).map((deviceId) => {
|
||||
MatrixClientPeg.get().setDeviceKnown(userId, deviceId, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
import { markAllDevicesKnown } from '../../../cryptodevices';
|
||||
|
||||
function DeviceListEntry(props) {
|
||||
const {userId, device} = props;
|
||||
|
@ -141,7 +134,7 @@ export default React.createClass({
|
|||
},
|
||||
|
||||
_onSendAnywayClicked: function() {
|
||||
markAllDevicesKnown(this.props.devices);
|
||||
markAllDevicesKnown(MatrixClientPeg.get(), this.props.devices);
|
||||
|
||||
this.props.onFinished();
|
||||
this.props.onSend();
|
||||
|
|
|
@ -19,6 +19,20 @@ import sdk from './index';
|
|||
import Modal from './Modal';
|
||||
import { _t } from './languageHandler';
|
||||
|
||||
/**
|
||||
* Mark all given devices as 'known'
|
||||
*
|
||||
* @param {MatrixClient} matrixClient A MatrixClient
|
||||
* @param {Object} map from userid -> deviceid -> deviceinfo
|
||||
*/
|
||||
export function markAllDevicesKnown(matrixClient, devices) {
|
||||
Object.keys(devices).forEach((userId) => {
|
||||
Object.keys(devices[userId]).map((deviceId) => {
|
||||
matrixClient.setDeviceKnown(userId, deviceId, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all crypto devices in a room that are marked neither known
|
||||
* nor verified.
|
||||
|
|
|
@ -272,9 +272,9 @@
|
|||
"Failed to mute user": "Failed to mute user",
|
||||
"Failed to toggle moderator status": "Failed to toggle moderator status",
|
||||
"Failed to change power level": "Failed to change power level",
|
||||
"You will not be able to undo this change as you are promoting the user to have the same power level as yourself.": "You will not be able to undo this change as you are promoting the user to have the same power level as yourself.",
|
||||
"You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.": "You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.",
|
||||
"Are you sure?": "Are you sure?",
|
||||
"You will not be able to undo this change as you are promoting the user to have the same power level as yourself.": "You will not be able to undo this change as you are promoting the user to have the same power level as yourself.",
|
||||
"No devices with registered encryption keys": "No devices with registered encryption keys",
|
||||
"Devices": "Devices",
|
||||
"Unignore": "Unignore",
|
||||
|
@ -344,10 +344,10 @@
|
|||
"Offline": "Offline",
|
||||
"Unknown": "Unknown",
|
||||
"Seen by %(userName)s at %(dateTime)s": "Seen by %(userName)s at %(dateTime)s",
|
||||
"No rooms to show": "No rooms to show",
|
||||
"Unnamed room": "Unnamed room",
|
||||
"World readable": "World readable",
|
||||
"Guests can join": "Guests can join",
|
||||
"No rooms to show": "No rooms to show",
|
||||
"Failed to set avatar.": "Failed to set avatar.",
|
||||
"Save": "Save",
|
||||
"(~%(count)s results)|other": "(~%(count)s results)",
|
||||
|
@ -558,6 +558,7 @@
|
|||
"Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?": "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?",
|
||||
"Delete widget": "Delete widget",
|
||||
"Revoke widget access": "Revoke widget access",
|
||||
"Minimize apps": "Minimize apps",
|
||||
"Edit": "Edit",
|
||||
"Create new room": "Create new room",
|
||||
"Unblacklist": "Unblacklist",
|
||||
|
@ -774,7 +775,7 @@
|
|||
"You have no visible notifications": "You have no visible notifications",
|
||||
"Scroll to bottom of page": "Scroll to bottom of page",
|
||||
"Message not sent due to unknown devices being present": "Message not sent due to unknown devices being present",
|
||||
"<showDevicesText>Show devices</showDevicesText> or <cancelText>cancel all</cancelText>.": "<showDevicesText>Show devices</showDevicesText> or <cancelText>cancel all</cancelText>.",
|
||||
"<showDevicesText>Show devices</showDevicesText>, <sendAnywayText>send without verifying</sendAnywayText> or <cancelText>cancel all</cancelText>.": "<showDevicesText>Show devices</showDevicesText>, <sendAnywayText>send without verifying</sendAnywayText> or <cancelText>cancel all</cancelText>.",
|
||||
"%(count)s of your messages have not been sent.|other": "Some of your messages have not been sent.",
|
||||
"%(count)s of your messages have not been sent.|one": "Your message was not sent.",
|
||||
"%(count)s <resendText>Resend all</resendText> or <cancelText>cancel all</cancelText> now. You can also select individual messages to resend or cancel.|other": "<resendText>Resend all</resendText> or <cancelText>cancel all</cancelText> now. You can also select individual messages to resend or cancel.",
|
||||
|
|
Loading…
Reference in a new issue