From d2d0ba952aba4999fd1f145c6632f45ad9267d06 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Jun 2017 04:23:07 +0100 Subject: [PATCH 1/2] allow hiding redactions. no point onAccountData as it'd cause a full refresh, this may need to be handled differently in the future. Currently handling same as the new timestamp stuff Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/MessagePanel.js | 5 +++ src/components/structures/TimelinePanel.js | 52 ++++++++++++---------- src/components/structures/UserSettings.js | 4 ++ src/i18n/strings/en_EN.json | 1 + 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index 6f49e425fd..5c68d4d206 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -90,6 +90,9 @@ module.exports = React.createClass({ // show timestamps always alwaysShowTimestamps: React.PropTypes.bool, + + // hide redacted events as per old behaviour + hideRedactions: React.PropTypes.bool, }, componentWillMount: function() { @@ -419,6 +422,8 @@ module.exports = React.createClass({ }, _getTilesForEvent: function(prevEvent, mxEv, last) { + if (mxEv.isRedacted() && this.props.hideRedactions) return []; + const EventTile = sdk.getComponent('rooms.EventTile'); const DateSeparator = sdk.getComponent('messages.DateSeparator'); var ret = []; diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 76004ebbac..aecb468f71 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -131,6 +131,8 @@ var TimelinePanel = React.createClass({ } } + const syncedSettings = UserSettingsStore.getSyncedSettings(); + return { events: [], timelineLoading: true, // track whether our room timeline is loading @@ -175,10 +177,13 @@ var TimelinePanel = React.createClass({ clientSyncState: MatrixClientPeg.get().getSyncState(), // should the event tiles have twelve hour times - isTwelveHour: UserSettingsStore.getSyncedSetting('showTwelveHourTimestamps'), + isTwelveHour: syncedSettings.showTwelveHourTimestamps, // always show timestamps on event tiles? - alwaysShowTimestamps: UserSettingsStore.getSyncedSetting('alwaysShowTimestamps'), + alwaysShowTimestamps: syncedSettings.alwaysShowTimestamps, + + // hide redacted events as per old behaviour + hideRedactions: syncedSettings.hideRedactions, }; }, @@ -915,7 +920,7 @@ var TimelinePanel = React.createClass({ }); }; } - var message = (error.errcode == 'M_FORBIDDEN') + var message = (error.errcode == 'M_FORBIDDEN') ? _t("Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question") + "." : _t("Tried to load a specific point in this room's timeline, but was unable to find it") + "."; Modal.createDialog(ErrorDialog, { @@ -1113,26 +1118,27 @@ var TimelinePanel = React.createClass({ ); return (