Allow sending hidden RRs

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-07-14 15:12:35 +02:00
parent 181a23d259
commit 226224b039
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
3 changed files with 14 additions and 2 deletions

View file

@ -758,16 +758,20 @@ class TimelinePanel extends React.Component<IProps, IState> {
} }
this.lastRMSentEventId = this.state.readMarkerEventId; this.lastRMSentEventId = this.state.readMarkerEventId;
const roomId = this.props.timelineSet.room.roomId;
const hiddenRR = !SettingsStore.getValue("sendReadReceipts", roomId);
debuglog('TimelinePanel: Sending Read Markers for ', debuglog('TimelinePanel: Sending Read Markers for ',
this.props.timelineSet.room.roomId, this.props.timelineSet.room.roomId,
'rm', this.state.readMarkerEventId, 'rm', this.state.readMarkerEventId,
lastReadEvent ? 'rr ' + lastReadEvent.getId() : '', lastReadEvent ? 'rr ' + lastReadEvent.getId() : '',
' hidden:' + hiddenRR,
); );
MatrixClientPeg.get().setRoomReadMarkers( MatrixClientPeg.get().setRoomReadMarkers(
this.props.timelineSet.room.roomId, roomId,
this.state.readMarkerEventId, this.state.readMarkerEventId,
lastReadEvent, // Could be null, in which case no RR is sent lastReadEvent, // Could be null, in which case no RR is sent
{}, { hidden: hiddenRR },
).catch((e) => { ).catch((e) => {
// /read_markers API is not implemented on this HS, fallback to just RR // /read_markers API is not implemented on this HS, fallback to just RR
if (e.errcode === 'M_UNRECOGNIZED' && lastReadEvent) { if (e.errcode === 'M_UNRECOGNIZED' && lastReadEvent) {

View file

@ -74,6 +74,7 @@ export default class LabsUserSettingsTab extends React.Component {
<SettingsFlag name="showHiddenEventsInTimeline" level={SettingLevel.DEVICE} /> <SettingsFlag name="showHiddenEventsInTimeline" level={SettingLevel.DEVICE} />
<SettingsFlag name="lowBandwidth" level={SettingLevel.DEVICE} /> <SettingsFlag name="lowBandwidth" level={SettingLevel.DEVICE} />
<SettingsFlag name="advancedRoomListLogging" level={SettingLevel.DEVICE} /> <SettingsFlag name="advancedRoomListLogging" level={SettingLevel.DEVICE} />
<SettingsFlag name={"sendReadReceipts"} level={SettingLevel.ACCOUNT} />
</div>; </div>;
} }

View file

@ -325,6 +325,13 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,
default: null, default: null,
}, },
"sendReadReceipts": {
supportedLevels: LEVELS_ROOM_SETTINGS,
displayName: _td(
"Send read receipts for messages (requires compatible homeserver to disable)",
),
default: true,
},
"baseFontSize": { "baseFontSize": {
displayName: _td("Font size"), displayName: _td("Font size"),
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,