Add option to stop sending read receipts (delabs MSC2285: private read receipts) (#8629)
Co-authored-by: Travis Ralston <travisr@matrix.org>
This commit is contained in:
parent
b61cc4850b
commit
7eaed1a3f8
11 changed files with 188 additions and 68 deletions
|
@ -29,6 +29,7 @@ import { UserTab } from "../../../dialogs/UserTab";
|
|||
import { OpenToTabPayload } from "../../../../../dispatcher/payloads/OpenToTabPayload";
|
||||
import { Action } from "../../../../../dispatcher/actions";
|
||||
import SdkConfig from "../../../../../SdkConfig";
|
||||
import { MatrixClientPeg } from "../../../../../MatrixClientPeg";
|
||||
import { showUserOnboardingPage } from "../../../user-onboarding/UserOnboardingPage";
|
||||
|
||||
interface IProps {
|
||||
|
@ -36,51 +37,59 @@ interface IProps {
|
|||
}
|
||||
|
||||
interface IState {
|
||||
disablingReadReceiptsSupported: boolean;
|
||||
autocompleteDelay: string;
|
||||
readMarkerInViewThresholdMs: string;
|
||||
readMarkerOutOfViewThresholdMs: string;
|
||||
}
|
||||
|
||||
export default class PreferencesUserSettingsTab extends React.Component<IProps, IState> {
|
||||
static ROOM_LIST_SETTINGS = [
|
||||
private static ROOM_LIST_SETTINGS = [
|
||||
'breadcrumbs',
|
||||
];
|
||||
|
||||
static SPACES_SETTINGS = [
|
||||
private static SPACES_SETTINGS = [
|
||||
"Spaces.allRoomsInHome",
|
||||
];
|
||||
|
||||
static KEYBINDINGS_SETTINGS = [
|
||||
private static KEYBINDINGS_SETTINGS = [
|
||||
'ctrlFForSearch',
|
||||
];
|
||||
|
||||
static COMPOSER_SETTINGS = [
|
||||
private static PRESENCE_SETTINGS = [
|
||||
"sendTypingNotifications",
|
||||
// sendReadReceipts - handled specially due to server needing support
|
||||
];
|
||||
|
||||
private static COMPOSER_SETTINGS = [
|
||||
'MessageComposerInput.autoReplaceEmoji',
|
||||
'MessageComposerInput.useMarkdown',
|
||||
'MessageComposerInput.suggestEmoji',
|
||||
'sendTypingNotifications',
|
||||
'MessageComposerInput.ctrlEnterToSend',
|
||||
'MessageComposerInput.surroundWith',
|
||||
'MessageComposerInput.showStickersButton',
|
||||
'MessageComposerInput.insertTrailingColon',
|
||||
];
|
||||
|
||||
static TIME_SETTINGS = [
|
||||
private static TIME_SETTINGS = [
|
||||
'showTwelveHourTimestamps',
|
||||
'alwaysShowTimestamps',
|
||||
];
|
||||
static CODE_BLOCKS_SETTINGS = [
|
||||
|
||||
private static CODE_BLOCKS_SETTINGS = [
|
||||
'enableSyntaxHighlightLanguageDetection',
|
||||
'expandCodeByDefault',
|
||||
'showCodeLineNumbers',
|
||||
];
|
||||
static IMAGES_AND_VIDEOS_SETTINGS = [
|
||||
|
||||
private static IMAGES_AND_VIDEOS_SETTINGS = [
|
||||
'urlPreviewsEnabled',
|
||||
'autoplayGifs',
|
||||
'autoplayVideo',
|
||||
'showImages',
|
||||
];
|
||||
static TIMELINE_SETTINGS = [
|
||||
|
||||
private static TIMELINE_SETTINGS = [
|
||||
'showTypingNotifications',
|
||||
'showRedactions',
|
||||
'showReadReceipts',
|
||||
|
@ -93,7 +102,8 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
|||
'scrollToBottomOnMessageSent',
|
||||
'useOnlyCurrentProfiles',
|
||||
];
|
||||
static GENERAL_SETTINGS = [
|
||||
|
||||
private static GENERAL_SETTINGS = [
|
||||
'promptBeforeInviteUnknownUsers',
|
||||
// Start automatically after startup (electron-only)
|
||||
// Autocomplete delay (niche text box)
|
||||
|
@ -103,6 +113,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
|||
super(props);
|
||||
|
||||
this.state = {
|
||||
disablingReadReceiptsSupported: false,
|
||||
autocompleteDelay:
|
||||
SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10),
|
||||
readMarkerInViewThresholdMs:
|
||||
|
@ -112,6 +123,15 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
|||
};
|
||||
}
|
||||
|
||||
public async componentDidMount(): Promise<void> {
|
||||
this.setState({
|
||||
disablingReadReceiptsSupported: (
|
||||
await MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2285.stable") ||
|
||||
await MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2285")
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
private onAutocompleteDelayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
this.setState({ autocompleteDelay: e.target.value });
|
||||
SettingsStore.setValue("autocompleteDelay", null, SettingLevel.DEVICE, e.target.value);
|
||||
|
@ -185,6 +205,20 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
|||
{ this.renderGroup(PreferencesUserSettingsTab.TIME_SETTINGS) }
|
||||
</div>
|
||||
|
||||
<div className="mx_SettingsTab_section">
|
||||
<span className="mx_SettingsTab_subheading">{ _t("Presence") }</span>
|
||||
<span className="mx_SettingsTab_subsectionText">
|
||||
{ _t("Share your activity and status with others.") }
|
||||
</span>
|
||||
<SettingsFlag
|
||||
disabled={!this.state.disablingReadReceiptsSupported}
|
||||
disabledDescription={_t("Your server doesn't support disabling sending read receipts.")}
|
||||
name="sendReadReceipts"
|
||||
level={SettingLevel.ACCOUNT}
|
||||
/>
|
||||
{ this.renderGroup(PreferencesUserSettingsTab.PRESENCE_SETTINGS) }
|
||||
</div>
|
||||
|
||||
<div className="mx_SettingsTab_section">
|
||||
<span className="mx_SettingsTab_subheading">{ _t("Composer") }</span>
|
||||
{ this.renderGroup(PreferencesUserSettingsTab.COMPOSER_SETTINGS) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue