Skip to content

Commit 60179aa

Browse files
authored
Merge pull request element-hq#2282 from vector-im/kegan/close-scalar
Listen for close_scalar and close the dialog box when received
2 parents 5f6cc9b + de38a32 commit 60179aa

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎src/components/views/settings/IntegrationsManager.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
var React = require('react');
2020
var sdk = require('matrix-react-sdk');
2121
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
22+
var dis = require('matrix-react-sdk/lib/dispatcher');
2223

2324
module.exports = React.createClass({
2425
displayName: 'IntegrationsManager',
@@ -31,10 +32,12 @@ module.exports = React.createClass({
3132
// XXX: keyboard shortcuts for managing dialogs should be done by the modal
3233
// dialog base class somehow, surely...
3334
componentDidMount: function() {
35+
this.dispatcherRef = dis.register(this.onAction);
3436
document.addEventListener("keydown", this.onKeyDown);
3537
},
3638

3739
componentWillUnmount: function() {
40+
dis.unregister(this.dispatcherRef);
3841
document.removeEventListener("keydown", this.onKeyDown);
3942
},
4043

@@ -46,6 +49,12 @@ module.exports = React.createClass({
4649
}
4750
},
4851

52+
onAction: function(payload) {
53+
if (payload.action === 'close_scalar') {
54+
this.props.onFinished();
55+
}
56+
},
57+
4958
render: function() {
5059
return (
5160
<div className="mx_IntegrationsManager">

0 commit comments

Comments
 (0)