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

* Allow specifying help URLs in config.json

* Fix test
This commit is contained in:
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> enable_presence_by_hs_url?: Record<string, boolean>; // <HomeserverName, Enabled>
terms_and_conditions_links?: { url: string; text: string }[]; terms_and_conditions_links?: { url: string; text: string }[];
help_url: string;
help_encryption_url: string;
latex_maths_delims?: { latex_maths_delims?: {
inline?: { 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 // see element-web config.md for docs, or the IConfigOptions interface for dev docs
export const DEFAULTS: DeepReadonly<IConfigOptions> = { export const DEFAULTS: DeepReadonly<IConfigOptions> = {
brand: "Element", brand: "Element",
help_url: "https://element.io/help",
help_encryption_url: "https://element.io/help#encryption",
integrations_ui_url: "https://scalar.vector.im/", integrations_ui_url: "https://scalar.vector.im/",
integrations_rest_url: "https://scalar.vector.im/api", integrations_rest_url: "https://scalar.vector.im/api",
uisi_autorageshake_app: "element-auto-uisi", uisi_autorageshake_app: "element-auto-uisi",

View file

@ -43,6 +43,7 @@ import PosthogTrackers from "../../../../../PosthogTrackers";
import MatrixClientContext from "../../../../../contexts/MatrixClientContext"; import MatrixClientContext from "../../../../../contexts/MatrixClientContext";
import { SettingsSection } from "../../shared/SettingsSection"; import { SettingsSection } from "../../shared/SettingsSection";
import SettingsTab from "../SettingsTab"; import SettingsTab from "../SettingsTab";
import SdkConfig from "../../../../../SdkConfig";
interface IProps { interface IProps {
room: Room; 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>", "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) => { onFinished: (confirm) => {

View file

@ -251,7 +251,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
brand, 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")) { if (SdkConfig.get("welcome_user_id") && getCurrentLanguage().startsWith("en")) {
@ -265,7 +265,11 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
}, },
{ {
a: (sub) => ( 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} {sub}
</ExternalLink> </ExternalLink>
), ),

View file

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