Add a 'View decrypted source' button
							parent
							
								
									363453fd06
								
							
						
					
					
						commit
						81d70a921d
					
				|  | @ -22,7 +22,8 @@ module.exports = React.createClass({ | |||
|     displayName: 'ViewSource', | ||||
| 
 | ||||
|     propTypes: { | ||||
|         onFinished: React.PropTypes.func.isRequired | ||||
|         content: React.PropTypes.object.isRequired, | ||||
|         onFinished: React.PropTypes.func.isRequired, | ||||
|     }, | ||||
| 
 | ||||
|     componentDidMount: function() { | ||||
|  | @ -45,10 +46,9 @@ module.exports = React.createClass({ | |||
|         return ( | ||||
|             <div className="mx_ViewSource"> | ||||
|                 <pre> | ||||
|                     {JSON.stringify(this.props.mxEvent.event, null, 2)} | ||||
|                     {JSON.stringify(this.props.content, null, 2)} | ||||
|                 </pre> | ||||
|             </div> | ||||
|         ); | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
|  |  | |||
|  | @ -47,7 +47,16 @@ module.exports = React.createClass({ | |||
|     onViewSourceClick: function() { | ||||
|         var ViewSource = sdk.getComponent('structures.ViewSource'); | ||||
|         Modal.createDialog(ViewSource, { | ||||
|             mxEvent: this.props.mxEvent | ||||
|             content: this.props.mxEvent.event, | ||||
|         }, 'mx_Dialog_viewsource'); | ||||
|         if (this.props.onFinished) this.props.onFinished(); | ||||
|     }, | ||||
| 
 | ||||
|     onViewClearSourceClick: function() { | ||||
|         var ViewSource = sdk.getComponent('structures.ViewSource'); | ||||
|         Modal.createDialog(ViewSource, { | ||||
|             // FIXME: _clearEvent is private
 | ||||
|             content: this.props.mxEvent._clearEvent, | ||||
|         }, 'mx_Dialog_viewsource'); | ||||
|         if (this.props.onFinished) this.props.onFinished(); | ||||
|     }, | ||||
|  | @ -97,6 +106,7 @@ module.exports = React.createClass({ | |||
|         var eventStatus = this.props.mxEvent.status; | ||||
|         var resendButton; | ||||
|         var viewSourceButton; | ||||
|         var viewClearSourceButton; | ||||
|         var redactButton; | ||||
|         var cancelButton; | ||||
|         var permalinkButton; | ||||
|  | @ -133,6 +143,14 @@ module.exports = React.createClass({ | |||
|             </div> | ||||
|         ); | ||||
| 
 | ||||
|         if (this.props.mxEvent.getType() !== this.props.mxEvent.getWireType()) { | ||||
|             viewClearSourceButton = ( | ||||
|                 <div className="mx_MessageContextMenu_field" onClick={this.onViewClearSourceClick}> | ||||
|                     View Decrypted Source | ||||
|                 </div> | ||||
|             ); | ||||
|         } | ||||
| 
 | ||||
|         if (this.props.eventTileOps) { | ||||
|             if (this.props.eventTileOps.isWidgetHidden()) { | ||||
|                 unhidePreviewButton = ( | ||||
|  | @ -174,6 +192,7 @@ module.exports = React.createClass({ | |||
|                 {redactButton} | ||||
|                 {cancelButton} | ||||
|                 {viewSourceButton} | ||||
|                 {viewClearSourceButton} | ||||
|                 {unhidePreviewButton} | ||||
|                 {permalinkButton} | ||||
|                 {UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Richard van der Hoff
						Richard van der Hoff