Move UDE handling to a its own file, adjust wording
This commit is contained in:
parent
816e0be3a0
commit
436e6b36f1
3 changed files with 36 additions and 13 deletions
32
src/UnknownDeviceErrorHandler.js
Normal file
32
src/UnknownDeviceErrorHandler.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import dis from './dispatcher';
|
||||||
|
import sdk from './index';
|
||||||
|
import Modal from './Modal';
|
||||||
|
|
||||||
|
const onAction = function(payload) {
|
||||||
|
if (payload.action === 'unknown_device_error') {
|
||||||
|
var UnknownDeviceDialog = sdk.getComponent("dialogs.UnknownDeviceDialog");
|
||||||
|
Modal.createDialog(UnknownDeviceDialog, {
|
||||||
|
devices: payload.err.devices,
|
||||||
|
room: payload.room,
|
||||||
|
onFinished: (r) => {
|
||||||
|
// XXX: temporary logging to try to diagnose
|
||||||
|
// https://github.com/vector-im/riot-web/issues/3148
|
||||||
|
console.log('UnknownDeviceDialog closed with '+r);
|
||||||
|
},
|
||||||
|
}, "mx_Dialog_unknownDevice");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let ref = null;
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
startListening: function () {
|
||||||
|
ref = dis.register(onAction);
|
||||||
|
},
|
||||||
|
stopListening: function () {
|
||||||
|
if (ref){
|
||||||
|
dis.unregister(ref);
|
||||||
|
ref = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
|
@ -42,6 +42,7 @@ var Lifecycle = require('../../Lifecycle');
|
||||||
var PageTypes = require('../../PageTypes');
|
var PageTypes = require('../../PageTypes');
|
||||||
|
|
||||||
var createRoom = require("../../createRoom");
|
var createRoom = require("../../createRoom");
|
||||||
|
var UDEHandler = require("../../UnknownDeviceErrorHandler");
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'MatrixChat',
|
displayName: 'MatrixChat',
|
||||||
|
@ -240,6 +241,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
|
UDEHandler.startListening();
|
||||||
|
|
||||||
this.focusComposer = false;
|
this.focusComposer = false;
|
||||||
window.addEventListener("focus", this.onFocus);
|
window.addEventListener("focus", this.onFocus);
|
||||||
|
@ -286,6 +288,7 @@ module.exports = React.createClass({
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
Lifecycle.stopMatrixClient();
|
Lifecycle.stopMatrixClient();
|
||||||
dis.unregister(this.dispatcherRef);
|
dis.unregister(this.dispatcherRef);
|
||||||
|
UDEHandler.stopListening();
|
||||||
window.removeEventListener("focus", this.onFocus);
|
window.removeEventListener("focus", this.onFocus);
|
||||||
window.removeEventListener('resize', this.handleResize);
|
window.removeEventListener('resize', this.handleResize);
|
||||||
},
|
},
|
||||||
|
@ -519,18 +522,6 @@ module.exports = React.createClass({
|
||||||
case 'set_theme':
|
case 'set_theme':
|
||||||
this._onSetTheme(payload.value);
|
this._onSetTheme(payload.value);
|
||||||
break;
|
break;
|
||||||
case 'unknown_device_error':
|
|
||||||
var UnknownDeviceDialog = sdk.getComponent("dialogs.UnknownDeviceDialog");
|
|
||||||
Modal.createDialog(UnknownDeviceDialog, {
|
|
||||||
devices: payload.err.devices,
|
|
||||||
room: payload.room,
|
|
||||||
onFinished: (r) => {
|
|
||||||
// XXX: temporary logging to try to diagnose
|
|
||||||
// https://github.com/vector-im/riot-web/issues/3148
|
|
||||||
console.log('UnknownDeviceDialog closed with '+r);
|
|
||||||
},
|
|
||||||
}, "mx_Dialog_unknownDevice");
|
|
||||||
break;
|
|
||||||
case 'resend_all_events':
|
case 'resend_all_events':
|
||||||
payload.room.getPendingEvents().filter(function(ev) {
|
payload.room.getPendingEvents().filter(function(ev) {
|
||||||
return ev.status === Matrix.EventStatus.NOT_SENT;
|
return ev.status === Matrix.EventStatus.NOT_SENT;
|
||||||
|
|
|
@ -132,7 +132,7 @@ export default React.createClass({
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
We recommend you go through the verification process
|
We recommend you go through the verification process
|
||||||
for each device before continuing, but you can retry
|
for each device before continuing, but you can send
|
||||||
without verifying if you prefer.
|
without verifying if you prefer.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue