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

Allow specifying help URLs in config.json #11070

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/IConfigOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?: {
Expand Down
2 changes: 2 additions & 0 deletions src/SdkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand All @@ -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>
),
Expand Down
2 changes: 2 additions & 0 deletions test/components/structures/MatrixChat-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down