Implement changes to MSC2285 (private read receipts) (#7993)

This commit is contained in:
Šimon Brandner
2022-05-06 21:32:47 +02:00
committed by GitHub
parent eca8494c66
commit 99543a7858
4 changed files with 16 additions and 9 deletions
+4 -3
View File
@@ -28,6 +28,7 @@ import { debounce } from 'lodash';
import { logger } from "matrix-js-sdk/src/logger";
import { ClientEvent } from "matrix-js-sdk/src/client";
import { Thread } from 'matrix-js-sdk/src/models/thread';
import { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts";
import SettingsStore from "../../settings/SettingsStore";
import { Layout } from "../../settings/enums/Layout";
@@ -862,14 +863,14 @@ class TimelinePanel extends React.Component<IProps, IState> {
MatrixClientPeg.get().setRoomReadMarkers(
roomId,
this.state.readMarkerEventId,
lastReadEvent, // Could be null, in which case no RR is sent
{ hidden: hiddenRR },
hiddenRR ? null : lastReadEvent, // Could be null, in which case no RR is sent
lastReadEvent, // Could be null, in which case no private RR is sent
).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,
{},
hiddenRR ? ReceiptType.ReadPrivate : ReceiptType.Read,
).catch((e) => {
logger.error(e);
this.lastRRSentEventId = undefined;