diff --git a/res/css/_components.scss b/res/css/_components.scss
index a0e5881201..788e22a766 100644
--- a/res/css/_components.scss
+++ b/res/css/_components.scss
@@ -123,6 +123,7 @@
@import "./views/messages/_MTextBody.scss";
@import "./views/messages/_MessageActionBar.scss";
@import "./views/messages/_MessageTimestamp.scss";
+@import "./views/messages/_MjolnirBody.scss";
@import "./views/messages/_ReactionsRow.scss";
@import "./views/messages/_ReactionsRowButton.scss";
@import "./views/messages/_ReactionsRowButtonTooltip.scss";
diff --git a/res/css/views/messages/_MjolnirBody.scss b/res/css/views/messages/_MjolnirBody.scss
new file mode 100644
index 0000000000..80be7429e5
--- /dev/null
+++ b/res/css/views/messages/_MjolnirBody.scss
@@ -0,0 +1,19 @@
+/*
+Copyright 2019 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.
+*/
+
+.mx_MjolnirBody {
+ opacity: 0.4;
+}
diff --git a/src/components/views/messages/MessageEvent.js b/src/components/views/messages/MessageEvent.js
index a616dd96ed..2e353794d7 100644
--- a/src/components/views/messages/MessageEvent.js
+++ b/src/components/views/messages/MessageEvent.js
@@ -18,6 +18,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import sdk from '../../../index';
+import SettingsStore from "../../../settings/SettingsStore";
+import {Mjolnir} from "../../../mjolnir/Mjolnir";
module.exports = createReactClass({
displayName: 'MessageEvent',
@@ -49,6 +51,10 @@ module.exports = createReactClass({
return this.refs.body && this.refs.body.getEventTileOps ? this.refs.body.getEventTileOps() : null;
},
+ onTileUpdate: function() {
+ this.forceUpdate();
+ },
+
render: function() {
const UnknownBody = sdk.getComponent('messages.UnknownBody');
@@ -81,6 +87,20 @@ module.exports = createReactClass({
}
}
+ if (SettingsStore.isFeatureEnabled("feature_mjolnir")) {
+ const allowRender = localStorage.getItem(`mx_mjolnir_render_${this.props.mxEvent.getRoomId()}__${this.props.mxEvent.getId()}`) === "true";
+
+ if (!allowRender) {
+ const userDomain = this.props.mxEvent.getSender().split(':').slice(1).join(':');
+ const userBanned = Mjolnir.sharedInstance().isUserBanned(this.props.mxEvent.getSender());
+ const serverBanned = Mjolnir.sharedInstance().isServerBanned(userDomain);
+
+ if (userBanned || serverBanned) {
+ BodyType = sdk.getComponent('messages.MjolnirBody');
+ }
+ }
+ }
+
return