From de1e8e9f9351ad93984f51d8a2f287b4163cf333 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 29 Oct 2015 00:38:26 +0000 Subject: [PATCH] implement redact and links --- src/skins/vector/views/atoms/ImageView.js | 35 +++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/skins/vector/views/atoms/ImageView.js b/src/skins/vector/views/atoms/ImageView.js index 69e6e787a7..16f6cd2248 100644 --- a/src/skins/vector/views/atoms/ImageView.js +++ b/src/skins/vector/views/atoms/ImageView.js @@ -18,13 +18,15 @@ limitations under the License. var React = require('react'); +var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); + var DateUtils = require('../../../../DateUtils'); var filesize = require('filesize'); module.exports = React.createClass({ displayName: 'ImageView', - // XXX: keyboard shortcuts for managing dialogs should be done by the modal dialog base class omehow, surely... + // XXX: keyboard shortcuts for managing dialogs should be done by the modal dialog base class somehow, surely... componentDidMount: function() { document.addEventListener("keydown", this.onKeyDown); }, @@ -41,6 +43,23 @@ module.exports = React.createClass({ } }, + onRedactClick: function() { + var self = this; + MatrixClientPeg.get().redactEvent( + this.props.mxEvent.getRoomId(), this.props.mxEvent.getId() + ).done(function() { + if (self.props.onFinished) self.props.onFinished(); + }, function(e) { + var ErrorDialog = sdk.getComponent("organisms.ErrorDialog"); + // display error message stating you couldn't delete this. + var code = e.errcode || e.statusCode; + Modal.createDialog(ErrorDialog, { + title: "Error", + description: "You cannot delete this image. (" + code + ")" + }); + }); + }, + render: function() { /* @@ -89,13 +108,17 @@ module.exports = React.createClass({
Uploaded on { DateUtils.formatDate(new Date(this.props.mxEvent.getTs())) } by { this.props.mxEvent.getSender() }
-
- Download this file ({ filesize(this.props.mxEvent.getContent().info.size) }) -
+ +
+ Download this file ({ filesize(this.props.mxEvent.getContent().info.size) }) +
+
- View full screen + + View full screen +
-
+
Redact