From 5ef61b7c35f0ca55695b09e5a5f1892bbcd22af8 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Mar 2017 16:45:29 +0000 Subject: [PATCH] Only show a redaction tile for messages --- src/components/views/messages/TextualBody.js | 4 ---- src/components/views/messages/UnknownBody.js | 7 +++++-- src/components/views/rooms/EventTile.js | 9 +++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 0030fe6575..a625e63062 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -246,10 +246,6 @@ module.exports = React.createClass({ var mxEvent = this.props.mxEvent; var content = mxEvent.getContent(); - if (mxEvent.isRedacted()) { - content = {body: "Message redacted by " + mxEvent.event.redacted_because.sender}; - } - var body = HtmlUtils.bodyToHtml(content, this.props.highlights, {}); if (this.props.highlightLink) { diff --git a/src/components/views/messages/UnknownBody.js b/src/components/views/messages/UnknownBody.js index 00784b18b0..5504c0b1fe 100644 --- a/src/components/views/messages/UnknownBody.js +++ b/src/components/views/messages/UnknownBody.js @@ -22,10 +22,13 @@ module.exports = React.createClass({ displayName: 'UnknownBody', render: function() { - var content = this.props.mxEvent.getContent(); + var text = this.props.mxEvent.getContent().body; + if (this.props.mxEvent.isRedacted()) { + text = "This event was redacted"; + } return ( - {content.body} + {text} ); }, diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index c262fea15f..087cef7689 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -388,7 +388,7 @@ module.exports = WithMatrixClient(React.createClass({ var e2eEnabled = this.props.matrixClient.isRoomEncrypted(this.props.mxEvent.getRoomId()); var isSending = (['sending', 'queued', 'encrypting'].indexOf(this.props.eventSendStatus) !== -1); - const isRedacted = this.props.mxEvent.isRedacted(); + const isRedacted = (eventType === 'm.room.message') && this.props.mxEvent.isRedacted(); var classes = classNames({ mx_EventTile: true, @@ -415,7 +415,10 @@ module.exports = WithMatrixClient(React.createClass({ let avatarSize; let needsSenderProfile; - if (this.props.tileShape === "notif") { + if (isRedacted) { + avatarSize = 0; + needsSenderProfile = false; + } else if (this.props.tileShape === "notif") { avatarSize = 24; needsSenderProfile = true; } else if (isInfoMessage) { @@ -560,6 +563,8 @@ module.exports = WithMatrixClient(React.createClass({ })); module.exports.haveTileForEvent = function(e) { + // Only messages have a tile (black-rectangle) if redacted + if (e.isRedacted() && e.getType() !== 'm.room.message') return false; if (eventTileTypes[e.getType()] == undefined) return false; if (eventTileTypes[e.getType()] == 'messages.TextualEvent') { return TextForEvent.textForEvent(e) !== '';