Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 9573eb1

Browse files
committed
Only show jump to date feature flag when your homserver supports it
See #7372 (comment)
1 parent 5984c1f commit 9573eb1

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/components/views/settings/tabs/user/LabsUserSettingsTab.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export class LabsSettingToggle extends React.Component<ILabsSettingToggleProps>
4949

5050
interface IState {
5151
showHiddenReadReceipts: boolean;
52+
showJumpToDate: boolean;
5253
}
5354

5455
@replaceableComponent("views.settings.tabs.user.LabsUserSettingsTab")
@@ -60,8 +61,13 @@ export default class LabsUserSettingsTab extends React.Component<{}, IState> {
6061
this.setState({ showHiddenReadReceipts });
6162
});
6263

64+
MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2716").then((showJumpToDate) => {
65+
this.setState({ showJumpToDate });
66+
});
67+
6368
this.state = {
6469
showHiddenReadReceipts: false,
70+
showJumpToDate: false,
6571
};
6672
}
6773

@@ -135,6 +141,16 @@ export default class LabsUserSettingsTab extends React.Component<{}, IState> {
135141
);
136142
}
137143

144+
if (this.state.showJumpToDate) {
145+
groups.getOrCreate(LabGroup.Messaging, []).push(
146+
<SettingsFlag
147+
key="feature_jump_to_date"
148+
name="feature_jump_to_date"
149+
level={SettingLevel.DEVICE}
150+
/>,
151+
);
152+
}
153+
138154
labsSection = <div className="mx_SettingsTab_section">
139155
{ sortBy(Array.from(groups.entries()), "0").map(([group, flags]) => (
140156
<div key={group}>

src/settings/Settings.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,11 @@ export const SETTINGS: {[setting: string]: ISetting} = {
368368
default: false,
369369
},
370370
"feature_jump_to_date": {
371-
isFeature: true,
372-
labsGroup: LabGroup.Messaging,
373-
displayName: _td("Jump to date (adds /jumptodate). Also requires your homeserver to have MSC3030 enabled"),
371+
// We purposely leave out `isFeature: true` so it doesn't show in Labs
372+
// by default. We will conditionally show it depending on whether we can
373+
// detect MSC3030 support (see LabUserSettingsTab.tsx).
374+
// labsGroup: LabGroup.Messaging,
375+
displayName: _td("Jump to date (adds /jumptodate)"),
374376
supportedLevels: LEVELS_FEATURE,
375377
default: false,
376378
},

0 commit comments

Comments
 (0)