File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,9 +52,27 @@ module.exports = React.createClass({
5252 if ( this . props . onFinished ) this . props . onFinished ( ) ;
5353 } ,
5454
55+ onRedactClick : function ( ) {
56+ MatrixClientPeg . get ( ) . redactEvent (
57+ this . props . mxEvent . getRoomId ( ) , this . props . mxEvent . getId ( )
58+ ) . done ( function ( ) {
59+ // message should disappear by itself
60+ } , function ( e ) {
61+ var ErrorDialog = sdk . getComponent ( "organisms.ErrorDialog" ) ;
62+ // display error message stating you couldn't delete this.
63+ var code = e . errcode || e . statusCode ;
64+ Modal . createDialog ( ErrorDialog , {
65+ title : "Error" ,
66+ description : "You cannot delete this message. (" + code + ")"
67+ } ) ;
68+ } ) ;
69+ if ( this . props . onFinished ) this . props . onFinished ( ) ;
70+ } ,
71+
5572 render : function ( ) {
5673 var resendButton ;
5774 var viewSourceButton ;
75+ var redactButton ;
5876
5977 if ( this . props . mxEvent . status == 'not_sent' ) {
6078 resendButton = (
@@ -63,6 +81,13 @@ module.exports = React.createClass({
6381 </ div >
6482 ) ;
6583 }
84+ else {
85+ redactButton = (
86+ < div className = "mx_ContextualMenu_field" onClick = { this . onRedactClick } >
87+ Delete
88+ </ div >
89+ ) ;
90+ }
6691 viewSourceButton = (
6792 < div className = "mx_ContextualMenu_field" onClick = { this . onViewSourceClick } >
6893 View Source
@@ -72,6 +97,7 @@ module.exports = React.createClass({
7297 return (
7398 < div >
7499 { resendButton }
100+ { redactButton }
75101 { viewSourceButton }
76102 </ div >
77103 ) ;
Original file line number Diff line number Diff line change @@ -173,6 +173,12 @@ module.exports = React.createClass({
173173 case this . FieldErrors . InUse :
174174 strings . push ( keys [ i ] + " is already taken" ) ;
175175 break ;
176+ case this . FieldErrors . Length :
177+ strings . push ( keys [ i ] + " is not long enough." ) ;
178+ break ;
179+ default :
180+ console . error ( "Unhandled FieldError: %s" , bad [ keys [ i ] ] ) ;
181+ break ;
176182 }
177183 }
178184 var errtxt = strings . join ( ', ' ) ;
You can’t perform that action at this time.
0 commit comments