From 7ada0bfeaa1250d5b8b920dd4293aedbd6416762 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 9 Jun 2023 12:26:04 +0100 Subject: [PATCH 1/2] Allow specifying help URLs in config.json --- src/IConfigOptions.ts | 2 ++ src/SdkConfig.ts | 2 ++ .../views/settings/tabs/room/SecurityRoomSettingsTab.tsx | 3 ++- .../views/settings/tabs/user/HelpUserSettingsTab.tsx | 8 ++++++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/IConfigOptions.ts b/src/IConfigOptions.ts index 1fa873ec87a..9efb490cc1c 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 be94bb5b08d..a12eb34d785 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 e4ffd3ae5e3..eb209c9a866 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 6a8018bee95..34da8288639 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} ), From 8482a7926c6afcbeee0f8fcb9c24f81d0b70e6d3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 9 Jun 2023 12:34:20 +0100 Subject: [PATCH 2/2] Fix test --- test/components/structures/MatrixChat-test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/components/structures/MatrixChat-test.tsx b/test/components/structures/MatrixChat-test.tsx index cc80057cf8b..dd81ecf68ca 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",