From ea0e9abc2bd3542914c04eb52a3b6109909e2233 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 14 Jun 2023 08:45:19 +0100 Subject: [PATCH] Allow specifying help URLs in config.json (#11070) * Allow specifying help URLs in config.json * Fix test --- src/IConfigOptions.ts | 2 ++ src/SdkConfig.ts | 2 ++ .../views/settings/tabs/room/SecurityRoomSettingsTab.tsx | 3 ++- .../views/settings/tabs/user/HelpUserSettingsTab.tsx | 8 ++++++-- test/components/structures/MatrixChat-test.tsx | 2 ++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/IConfigOptions.ts b/src/IConfigOptions.ts index 1fa873ec87..9efb490cc1 100644 --- a/src/IConfigOptions.ts +++ b/src/IConfigOptions.ts @@ -152,6 +152,8 @@ export interface IConfigOptions { enable_presence_by_hs_url?: Record; // terms_and_conditions_links?: { url: string; text: string }[]; + help_url: string; + help_encryption_url: string; latex_maths_delims?: { inline?: { diff --git a/src/SdkConfig.ts b/src/SdkConfig.ts index be94bb5b08..a12eb34d78 100644 --- a/src/SdkConfig.ts +++ b/src/SdkConfig.ts @@ -26,6 +26,8 @@ import { DeepReadonly, Defaultize } from "./@types/common"; // see element-web config.md for docs, or the IConfigOptions interface for dev docs export const DEFAULTS: DeepReadonly = { brand: "Element", + help_url: "https://element.io/help", + help_encryption_url: "https://element.io/help#encryption", integrations_ui_url: "https://scalar.vector.im/", integrations_rest_url: "https://scalar.vector.im/api", uisi_autorageshake_app: "element-auto-uisi", diff --git a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx index e4ffd3ae5e..eb209c9a86 100644 --- a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx @@ -43,6 +43,7 @@ import PosthogTrackers from "../../../../../PosthogTrackers"; import MatrixClientContext from "../../../../../contexts/MatrixClientContext"; import { SettingsSection } from "../../shared/SettingsSection"; import SettingsTab from "../SettingsTab"; +import SdkConfig from "../../../../../SdkConfig"; interface IProps { room: Room; @@ -163,7 +164,7 @@ export default class SecurityRoomSettingsTab extends React.ComponentLearn more about encryption.", {}, { - a: (sub) => {sub}, + a: (sub) => {sub}, }, ), onFinished: (confirm) => { diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx index 6a8018bee9..34da828863 100644 --- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx @@ -251,7 +251,7 @@ export default class HelpUserSettingsTab extends React.Component brand, }, { - a: (sub) => {sub}, + a: (sub) => {sub}, }, ); if (SdkConfig.get("welcome_user_id") && getCurrentLanguage().startsWith("en")) { @@ -265,7 +265,11 @@ export default class HelpUserSettingsTab extends React.Component }, { a: (sub) => ( - + {sub} ), diff --git a/test/components/structures/MatrixChat-test.tsx b/test/components/structures/MatrixChat-test.tsx index cc80057cf8..dd81ecf68c 100644 --- a/test/components/structures/MatrixChat-test.tsx +++ b/test/components/structures/MatrixChat-test.tsx @@ -70,6 +70,8 @@ describe("", () => { const defaultProps: ComponentProps = { config: { brand: "Test", + help_url: "help_url", + help_encryption_url: "help_encryption_url", element_call: {}, feedback: { existing_issues_url: "https://feedback.org/existing",