Remove host signup link from UserMenu.tsx

It duplicates the new host signup modal dialog.
pull/21833/head
Jason Robinson 2021-02-09 20:01:45 +02:00
parent d2f3192d10
commit a4a478cf72
1 changed files with 2 additions and 27 deletions

View File

@ -28,7 +28,6 @@ import Modal from "../../Modal";
import LogoutDialog from "../views/dialogs/LogoutDialog"; import LogoutDialog from "../views/dialogs/LogoutDialog";
import SettingsStore from "../../settings/SettingsStore"; import SettingsStore from "../../settings/SettingsStore";
import {getCustomTheme} from "../../theme"; import {getCustomTheme} from "../../theme";
import {getHostingLink} from "../../utils/HostingLink";
import AccessibleButton, {ButtonEvent} from "../views/elements/AccessibleButton"; import AccessibleButton, {ButtonEvent} from "../views/elements/AccessibleButton";
import SdkConfig from "../../SdkConfig"; import SdkConfig from "../../SdkConfig";
import {getHomePageUrl} from "../../utils/pages"; import {getHomePageUrl} from "../../utils/pages";
@ -274,7 +273,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
const prototypeCommunityName = CommunityPrototypeStore.instance.getSelectedCommunityName(); const prototypeCommunityName = CommunityPrototypeStore.instance.getSelectedCommunityName();
let topSection; let topSection;
const signupLink = getHostingLink("user-context-menu");
const hostSignupConfig: IHostSignupConfig = SdkConfig.get().hostSignup; const hostSignupConfig: IHostSignupConfig = SdkConfig.get().hostSignup;
if (MatrixClientPeg.get().isGuest()) { if (MatrixClientPeg.get().isGuest()) {
topSection = ( topSection = (
@ -295,8 +293,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
})} })}
</div> </div>
) )
} else if (signupLink || hostSignupConfig) { } else if (hostSignupConfig) {
let hostSignupAction;
if (hostSignupConfig && hostSignupConfig.url) { if (hostSignupConfig && hostSignupConfig.url) {
// If hostSignup.domains is set to a non-empty array, only show // If hostSignup.domains is set to a non-empty array, only show
// dialog if the user is on the domain or a subdomain. // dialog if the user is on the domain or a subdomain.
@ -304,33 +301,11 @@ export default class UserMenu extends React.Component<IProps, IState> {
const mxDomain = MatrixClientPeg.get().getDomain(); const mxDomain = MatrixClientPeg.get().getDomain();
const validDomains = hostSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`))); const validDomains = hostSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
if (!hostSignupDomains || validDomains.length > 0) { if (!hostSignupDomains || validDomains.length > 0) {
hostSignupAction = <div topSection = <div onClick={this.onCloseMenu}>
className=""
onClick={this.onCloseMenu}
>
<HostSignupAction /> <HostSignupAction />
</div>; </div>;
} }
} }
topSection = (
<>
{signupLink &&
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_hostingLink">
{_t(
"<a>Upgrade</a> to your own domain", {},
{
a: sub => (
<a href={signupLink} target="_blank" rel="noreferrer noopener" tabIndex={-1}>
{sub}
</a>
),
},
)}
</div>
}
{hostSignupAction}
</>
);
} }
let homeButton = null; let homeButton = null;