From af35cdc2ea87fe38b8fd70996cf3e5279918feea Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 5 Sep 2019 20:30:19 -0600 Subject: [PATCH 1/2] Support sending hidden read receipts Fixes https://github.com/vector-im/riot-web/issues/2527 --- src/components/structures/TimelinePanel.js | 5 +++++ .../views/settings/tabs/user/LabsUserSettingsTab.js | 1 + src/i18n/strings/en_EN.json | 1 + src/settings/Settings.js | 7 +++++++ 4 files changed, 14 insertions(+) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index cdeea78204d..44569569b6c 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -685,20 +685,25 @@ const TimelinePanel = createReactClass({ } this.lastRMSentEventId = this.state.readMarkerEventId; + const hiddenRR = !SettingsStore.getValue("sendReadReceipts"); + debuglog('TimelinePanel: Sending Read Markers for ', this.props.timelineSet.room.roomId, 'rm', this.state.readMarkerEventId, lastReadEvent ? 'rr ' + lastReadEvent.getId() : '', + ' hidden:' + hiddenRR, ); MatrixClientPeg.get().setRoomReadMarkers( this.props.timelineSet.room.roomId, this.state.readMarkerEventId, lastReadEvent, // Could be null, in which case no RR is sent + {hidden: hiddenRR}, ).catch((e) => { // /read_markers API is not implemented on this HS, fallback to just RR if (e.errcode === 'M_UNRECOGNIZED' && lastReadEvent) { return MatrixClientPeg.get().sendReadReceipt( lastReadEvent, + {hidden: hiddenRR}, ).catch((e) => { console.error(e); this.lastRRSentEventId = undefined; diff --git a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js index 9c2d49a8bf2..07a2bf722ae 100644 --- a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js @@ -54,6 +54,7 @@ export default class LabsUserSettingsTab extends React.Component { + ); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index dd0894b8138..acccade834a 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -367,6 +367,7 @@ "Show hidden events in timeline": "Show hidden events in timeline", "Low bandwidth mode": "Low bandwidth mode", "Allow fallback call assist server turn.matrix.org when your homeserver does not offer one (your IP address would be shared during a call)": "Allow fallback call assist server turn.matrix.org when your homeserver does not offer one (your IP address would be shared during a call)", + "Send read receipts for messages (requires compatible homeserver to disable)": "Send read receipts for messages (requires compatible homeserver to disable)", "Collecting app version information": "Collecting app version information", "Collecting logs": "Collecting logs", "Uploading report": "Uploading report", diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 70abf406b85..f86a8566c63 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -394,4 +394,11 @@ export const SETTINGS = { // This is a tri-state value, where `null` means "prompt the user". default: null, }, + "sendReadReceipts": { + supportedLevels: LEVELS_ACCOUNT_SETTINGS, + displayName: _td( + "Send read receipts for messages (requires compatible homeserver to disable)", + ), + default: true, + }, }; From e29184ae1d43934e36f5b067e520b624a0e39cb4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 6 Sep 2019 13:02:18 -0600 Subject: [PATCH 2/2] Support secret per-room hidden read receipts --- src/components/structures/TimelinePanel.js | 3 ++- src/settings/Settings.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 44569569b6c..0ca1cb99965 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -685,7 +685,8 @@ const TimelinePanel = createReactClass({ } this.lastRMSentEventId = this.state.readMarkerEventId; - const hiddenRR = !SettingsStore.getValue("sendReadReceipts"); + const roomId = this.props.timelineSet.room.roomId; + const hiddenRR = !SettingsStore.getValue("sendReadReceipts", roomId); debuglog('TimelinePanel: Sending Read Markers for ', this.props.timelineSet.room.roomId, diff --git a/src/settings/Settings.js b/src/settings/Settings.js index f86a8566c63..7b049208aad 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -395,7 +395,7 @@ export const SETTINGS = { default: null, }, "sendReadReceipts": { - supportedLevels: LEVELS_ACCOUNT_SETTINGS, + supportedLevels: LEVELS_ROOM_SETTINGS, displayName: _td( "Send read receipts for messages (requires compatible homeserver to disable)", ),