@@ -23,6 +23,8 @@ var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
2323var DateUtils = require ( 'matrix-react-sdk/lib/DateUtils' ) ;
2424var filesize = require ( 'filesize' ) ;
2525var AccessibleButton = require ( 'matrix-react-sdk/lib/components/views/elements/AccessibleButton' ) ;
26+ const Modal = require ( 'matrix-react-sdk/lib/Modal' ) ;
27+ const sdk = require ( 'matrix-react-sdk' ) ;
2628
2729module . exports = React . createClass ( {
2830 displayName : 'ImageView' ,
@@ -62,19 +64,23 @@ module.exports = React.createClass({
6264 } ,
6365
6466 onRedactClick : function ( ) {
65- var self = this ;
66- MatrixClientPeg . get ( ) . redactEvent (
67- this . props . mxEvent . getRoomId ( ) , this . props . mxEvent . getId ( )
68- ) . done ( function ( ) {
69- if ( self . props . onFinished ) self . props . onFinished ( ) ;
70- } , function ( e ) {
71- var ErrorDialog = sdk . getComponent ( "dialogs.ErrorDialog" ) ;
72- // display error message stating you couldn't delete this.
73- var code = e . errcode || e . statusCode ;
74- Modal . createDialog ( ErrorDialog , {
75- title : "Error" ,
76- description : "You cannot delete this image. (" + code + ")"
77- } ) ;
67+ const ConfirmRedactDialog = sdk . getComponent ( "dialogs.ConfirmRedactDialog" ) ;
68+ Modal . createDialog ( ConfirmRedactDialog , {
69+ onFinished : ( proceed ) => {
70+ if ( ! proceed ) return ;
71+ var self = this ;
72+ MatrixClientPeg . get ( ) . redactEvent (
73+ this . props . mxEvent . getRoomId ( ) , this . props . mxEvent . getId ( )
74+ ) . catch ( function ( e ) {
75+ var ErrorDialog = sdk . getComponent ( "dialogs.ErrorDialog" ) ;
76+ // display error message stating you couldn't delete this.
77+ var code = e . errcode || e . statusCode ;
78+ Modal . createDialog ( ErrorDialog , {
79+ title : "Error" ,
80+ description : "You cannot delete this image. (" + code + ")"
81+ } ) ;
82+ } ) . done ( ) ;
83+ }
7884 } ) ;
7985 } ,
8086
0 commit comments