Only show a redaction tile for messages

This commit is contained in:
Luke Barnard 2017-03-03 16:45:29 +00:00
parent 6c32e3720b
commit 5ef61b7c35
3 changed files with 12 additions and 8 deletions

View file

@ -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) {

View file

@ -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 (
<span className="mx_UnknownBody">
{content.body}
{text}
</span>
);
},

View file

@ -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) !== '';