Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit adfeff3

Browse files
authored
Merge pull request #1004 from matrix-org/t3chguy/hide_redactions
allow hiding redactions, restoring old behaviour
2 parents 43b18db + 5e2e550 commit adfeff3

File tree

4 files changed

+39
-23
lines changed

4 files changed

+39
-23
lines changed

src/components/structures/MessagePanel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ module.exports = React.createClass({
9090

9191
// show timestamps always
9292
alwaysShowTimestamps: React.PropTypes.bool,
93+
94+
// hide redacted events as per old behaviour
95+
hideRedactions: React.PropTypes.bool,
9396
},
9497

9598
componentWillMount: function() {
@@ -463,6 +466,8 @@ module.exports = React.createClass({
463466
continuation = false;
464467
}
465468

469+
if (mxEv.isRedacted() && this.props.hideRedactions) return ret;
470+
466471
var eventId = mxEv.getId();
467472
var highlight = (eventId == this.props.highlightedEventId);
468473

src/components/structures/TimelinePanel.js

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ var TimelinePanel = React.createClass({
131131
}
132132
}
133133

134+
const syncedSettings = UserSettingsStore.getSyncedSettings();
135+
134136
return {
135137
events: [],
136138
timelineLoading: true, // track whether our room timeline is loading
@@ -175,10 +177,13 @@ var TimelinePanel = React.createClass({
175177
clientSyncState: MatrixClientPeg.get().getSyncState(),
176178

177179
// should the event tiles have twelve hour times
178-
isTwelveHour: UserSettingsStore.getSyncedSetting('showTwelveHourTimestamps'),
180+
isTwelveHour: syncedSettings.showTwelveHourTimestamps,
179181

180182
// always show timestamps on event tiles?
181-
alwaysShowTimestamps: UserSettingsStore.getSyncedSetting('alwaysShowTimestamps'),
183+
alwaysShowTimestamps: syncedSettings.alwaysShowTimestamps,
184+
185+
// hide redacted events as per old behaviour
186+
hideRedactions: syncedSettings.hideRedactions,
182187
};
183188
},
184189

@@ -915,7 +920,7 @@ var TimelinePanel = React.createClass({
915920
});
916921
};
917922
}
918-
var message = (error.errcode == 'M_FORBIDDEN')
923+
var message = (error.errcode == 'M_FORBIDDEN')
919924
? _t("Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question") + "."
920925
: _t("Tried to load a specific point in this room's timeline, but was unable to find it") + ".";
921926
Modal.createDialog(ErrorDialog, {
@@ -1113,26 +1118,27 @@ var TimelinePanel = React.createClass({
11131118
);
11141119
return (
11151120
<MessagePanel ref="messagePanel"
1116-
hidden={ this.props.hidden }
1117-
backPaginating={ this.state.backPaginating }
1118-
forwardPaginating={ forwardPaginating }
1119-
events={ this.state.events }
1120-
highlightedEventId={ this.props.highlightedEventId }
1121-
readMarkerEventId={ this.state.readMarkerEventId }
1122-
readMarkerVisible={ this.state.readMarkerVisible }
1123-
suppressFirstDateSeparator={ this.state.canBackPaginate }
1124-
showUrlPreview = { this.props.showUrlPreview }
1125-
manageReadReceipts = { this.props.manageReadReceipts }
1126-
ourUserId={ MatrixClientPeg.get().credentials.userId }
1127-
stickyBottom={ stickyBottom }
1128-
onScroll={ this.onMessageListScroll }
1129-
onFillRequest={ this.onMessageListFillRequest }
1130-
onUnfillRequest={ this.onMessageListUnfillRequest }
1131-
opacity={ this.props.opacity }
1132-
isTwelveHour={ this.state.isTwelveHour }
1133-
alwaysShowTimestamps={ this.state.alwaysShowTimestamps }
1134-
className={ this.props.className }
1135-
tileShape={ this.props.tileShape }
1121+
hidden={ this.props.hidden }
1122+
hideRedactions={ this.state.hideRedactions }
1123+
backPaginating={ this.state.backPaginating }
1124+
forwardPaginating={ forwardPaginating }
1125+
events={ this.state.events }
1126+
highlightedEventId={ this.props.highlightedEventId }
1127+
readMarkerEventId={ this.state.readMarkerEventId }
1128+
readMarkerVisible={ this.state.readMarkerVisible }
1129+
suppressFirstDateSeparator={ this.state.canBackPaginate }
1130+
showUrlPreview = { this.props.showUrlPreview }
1131+
manageReadReceipts = { this.props.manageReadReceipts }
1132+
ourUserId={ MatrixClientPeg.get().credentials.userId }
1133+
stickyBottom={ stickyBottom }
1134+
onScroll={ this.onMessageListScroll }
1135+
onFillRequest={ this.onMessageListFillRequest }
1136+
onUnfillRequest={ this.onMessageListUnfillRequest }
1137+
opacity={ this.props.opacity }
1138+
isTwelveHour={ this.state.isTwelveHour }
1139+
alwaysShowTimestamps={ this.state.alwaysShowTimestamps }
1140+
className={ this.props.className }
1141+
tileShape={ this.props.tileShape }
11361142
/>
11371143
);
11381144
},

src/components/structures/UserSettings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ const SETTINGS_LABELS = [
8484
id: 'useCompactLayout',
8585
label: 'Use compact timeline layout',
8686
},
87+
{
88+
id: 'hideRedactions',
89+
label: 'Hide removed messages',
90+
},
8791
/*
8892
{
8993
id: 'useFixedWidthFont',

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Camera": "Camera",
142142
"Advanced": "Advanced",
143143
"Algorithm": "Algorithm",
144+
"Hide removed messages": "Hide removed messages",
144145
"Always show message timestamps": "Always show message timestamps",
145146
"Authentication": "Authentication",
146147
"all room members": "all room members",

0 commit comments

Comments
 (0)