diff --git a/res/css/_components.scss b/res/css/_components.scss index 0344074369..428a28ac3a 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -144,6 +144,7 @@ @import "./views/messages/_RoomAvatarEvent.scss"; @import "./views/messages/_SenderProfile.scss"; @import "./views/messages/_TextualEvent.scss"; +@import "./views/messages/_UnknownBody.scss"; @import "./views/messages/_ViewSourceEvent.scss"; @import "./views/messages/_common_CryptoEvent.scss"; @import "./views/right_panel/_EncryptionInfo.scss"; diff --git a/res/css/views/messages/_UnknownBody.scss b/res/css/views/messages/_UnknownBody.scss new file mode 100644 index 0000000000..9036e12bf0 --- /dev/null +++ b/res/css/views/messages/_UnknownBody.scss @@ -0,0 +1,16 @@ +/* +Copyright 2015, 2016 OpenMarket Ltd +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +.mx_UnknownBody { + white-space: pre-wrap; +} diff --git a/src/components/views/messages/EditHistoryMessage.js b/src/components/views/messages/EditHistoryMessage.js index e0ca23d244..df27773a40 100644 --- a/src/components/views/messages/EditHistoryMessage.js +++ b/src/components/views/messages/EditHistoryMessage.js @@ -158,7 +158,6 @@ export default class EditHistoryMessage extends React.PureComponent { const isSending = (['sending', 'queued', 'encrypting'].indexOf(this.state.sendStatus) !== -1); const classes = classNames({ "mx_EventTile": true, - "mx_EventTile_redacted": mxEvent.isRedacted(), "mx_EventTile_sending": isSending, "mx_EventTile_notSent": this.state.sendStatus === 'not_sent', }); diff --git a/src/components/views/messages/MessageEvent.js b/src/components/views/messages/MessageEvent.js index f8bd23cbe3..eb74270762 100644 --- a/src/components/views/messages/MessageEvent.js +++ b/src/components/views/messages/MessageEvent.js @@ -21,6 +21,7 @@ import * as sdk from '../../../index'; import SettingsStore from "../../../settings/SettingsStore"; import {Mjolnir} from "../../../mjolnir/Mjolnir"; import RedactedBody from "./RedactedBody"; +import UnknownBody from "./UnknownBody"; export default createReactClass({ displayName: 'MessageEvent', @@ -88,6 +89,9 @@ export default createReactClass({ } else if (content.url) { // Fallback to MFileBody if there's a content URL BodyType = bodyTypes['m.file']; + } else { + // Fallback to UnknownBody otherwise if not redacted + BodyType = UnknownBody; } } diff --git a/src/components/views/messages/UnknownBody.js b/src/components/views/messages/UnknownBody.js new file mode 100644 index 0000000000..6c00921b45 --- /dev/null +++ b/src/components/views/messages/UnknownBody.js @@ -0,0 +1,27 @@ +/* +Copyright 2015, 2016 OpenMarket Ltd +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from "react"; + +export default ({mxEvent}) => { + const text = mxEvent.getContent().body; + return ( + + { text } + + ); +}; diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index a64fd82eb5..33ee8a0f63 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -670,7 +670,6 @@ export default createReactClass({ mx_EventTile_unknown: !isBubbleMessage && this.state.verified === E2E_STATE.UNKNOWN, mx_EventTile_bad: isEncryptionFailure, mx_EventTile_emote: msgtype === 'm.emote', - mx_EventTile_redacted: isRedacted, }); let permalink = "#";