Remove support for unstable private read receipts (#9225)

This commit is contained in:
Šimon Brandner 2022-09-12 18:04:16 +02:00 committed by GitHub
parent e52ef4522d
commit 28a418dd2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -30,7 +30,6 @@ import { ClientEvent } from "matrix-js-sdk/src/client";
import { Thread } from 'matrix-js-sdk/src/models/thread'; import { Thread } from 'matrix-js-sdk/src/models/thread';
import { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts"; import { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts";
import { MatrixError } from 'matrix-js-sdk/src/http-api'; import { MatrixError } from 'matrix-js-sdk/src/http-api';
import { getPrivateReadReceiptField } from "matrix-js-sdk/src/utils";
import SettingsStore from "../../settings/SettingsStore"; import SettingsStore from "../../settings/SettingsStore";
import { Layout } from "../../settings/enums/Layout"; import { Layout } from "../../settings/enums/Layout";
@ -983,13 +982,15 @@ class TimelinePanel extends React.Component<IProps, IState> {
).catch(async (e) => { ).catch(async (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) {
const privateField = await getPrivateReadReceiptField(MatrixClientPeg.get()); if (
if (!sendRRs && !privateField) return; !sendRRs
&& !MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2285.stable")
) return;
try { try {
return await MatrixClientPeg.get().sendReadReceipt( return await MatrixClientPeg.get().sendReadReceipt(
lastReadEvent, lastReadEvent,
sendRRs ? ReceiptType.Read : privateField, sendRRs ? ReceiptType.Read : ReceiptType.ReadPrivate,
); );
} catch (error) { } catch (error) {
logger.error(e); logger.error(e);

View file

@ -127,8 +127,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
public async componentDidMount(): Promise<void> { public async componentDidMount(): Promise<void> {
this.setState({ this.setState({
disablingReadReceiptsSupported: ( disablingReadReceiptsSupported: (
await MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2285.stable") || await MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2285.stable")
await MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2285")
), ),
}); });
} }