Allow specifying help URLs in config.json (#11070)

* Allow specifying help URLs in config.json

* Fix test
pull/28788/head^2
Michael Telatynski 2023-06-14 08:45:19 +01:00 committed by GitHub
parent ba28174ac0
commit ea0e9abc2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 3 deletions

View File

@ -152,6 +152,8 @@ export interface IConfigOptions {
enable_presence_by_hs_url?: Record<string, boolean>; // <HomeserverName, Enabled>
terms_and_conditions_links?: { url: string; text: string }[];
help_url: string;
help_encryption_url: string;
latex_maths_delims?: {
inline?: {

View File

@ -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<IConfigOptions> = {
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",

View File

@ -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.Component<IProps, ISt
"may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>",
{},
{
a: (sub) => <ExternalLink href="https://element.io/help#encryption">{sub}</ExternalLink>,
a: (sub) => <ExternalLink href={SdkConfig.get("help_encryption_url")}>{sub}</ExternalLink>,
},
),
onFinished: (confirm) => {

View File

@ -251,7 +251,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
brand,
},
{
a: (sub) => <ExternalLink href="https://element.io/help">{sub}</ExternalLink>,
a: (sub) => <ExternalLink href={SdkConfig.get("help_url")}>{sub}</ExternalLink>,
},
);
if (SdkConfig.get("welcome_user_id") && getCurrentLanguage().startsWith("en")) {
@ -265,7 +265,11 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
},
{
a: (sub) => (
<ExternalLink href="https://element.io/help" rel="noreferrer noopener" target="_blank">
<ExternalLink
href={SdkConfig.get("help_url")}
rel="noreferrer noopener"
target="_blank"
>
{sub}
</ExternalLink>
),

View File

@ -70,6 +70,8 @@ describe("<MatrixChat />", () => {
const defaultProps: ComponentProps<typeof MatrixChat> = {
config: {
brand: "Test",
help_url: "help_url",
help_encryption_url: "help_encryption_url",
element_call: {},
feedback: {
existing_issues_url: "https://feedback.org/existing",