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

Commit ea0e9ab

Browse files
authored
Allow specifying help URLs in config.json (#11070)
* Allow specifying help URLs in config.json * Fix test
1 parent ba28174 commit ea0e9ab

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

src/IConfigOptions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ export interface IConfigOptions {
152152
enable_presence_by_hs_url?: Record<string, boolean>; // <HomeserverName, Enabled>
153153

154154
terms_and_conditions_links?: { url: string; text: string }[];
155+
help_url: string;
156+
help_encryption_url: string;
155157

156158
latex_maths_delims?: {
157159
inline?: {

src/SdkConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { DeepReadonly, Defaultize } from "./@types/common";
2626
// see element-web config.md for docs, or the IConfigOptions interface for dev docs
2727
export const DEFAULTS: DeepReadonly<IConfigOptions> = {
2828
brand: "Element",
29+
help_url: "https://element.io/help",
30+
help_encryption_url: "https://element.io/help#encryption",
2931
integrations_ui_url: "https://scalar.vector.im/",
3032
integrations_rest_url: "https://scalar.vector.im/api",
3133
uisi_autorageshake_app: "element-auto-uisi",

src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import PosthogTrackers from "../../../../../PosthogTrackers";
4343
import MatrixClientContext from "../../../../../contexts/MatrixClientContext";
4444
import { SettingsSection } from "../../shared/SettingsSection";
4545
import SettingsTab from "../SettingsTab";
46+
import SdkConfig from "../../../../../SdkConfig";
4647

4748
interface IProps {
4849
room: Room;
@@ -163,7 +164,7 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
163164
"may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>",
164165
{},
165166
{
166-
a: (sub) => <ExternalLink href="https://element.io/help#encryption">{sub}</ExternalLink>,
167+
a: (sub) => <ExternalLink href={SdkConfig.get("help_encryption_url")}>{sub}</ExternalLink>,
167168
},
168169
),
169170
onFinished: (confirm) => {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
251251
brand,
252252
},
253253
{
254-
a: (sub) => <ExternalLink href="https://element.io/help">{sub}</ExternalLink>,
254+
a: (sub) => <ExternalLink href={SdkConfig.get("help_url")}>{sub}</ExternalLink>,
255255
},
256256
);
257257
if (SdkConfig.get("welcome_user_id") && getCurrentLanguage().startsWith("en")) {
@@ -265,7 +265,11 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
265265
},
266266
{
267267
a: (sub) => (
268-
<ExternalLink href="https://element.io/help" rel="noreferrer noopener" target="_blank">
268+
<ExternalLink
269+
href={SdkConfig.get("help_url")}
270+
rel="noreferrer noopener"
271+
target="_blank"
272+
>
269273
{sub}
270274
</ExternalLink>
271275
),

test/components/structures/MatrixChat-test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ describe("<MatrixChat />", () => {
7070
const defaultProps: ComponentProps<typeof MatrixChat> = {
7171
config: {
7272
brand: "Test",
73+
help_url: "help_url",
74+
help_encryption_url: "help_encryption_url",
7375
element_call: {},
7476
feedback: {
7577
existing_issues_url: "https://feedback.org/existing",

0 commit comments

Comments
 (0)