From 54b22290e7e2902bc781877399fd411619a9d0d3 Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Fri, 13 Nov 2020 12:44:48 +0200 Subject: [PATCH] Add hosting_signup_domains for controlling which users see the hosting signup dialog --- src/components/structures/UserMenu.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index af6b7b762f..d92b233c52 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -315,12 +315,19 @@ export default class UserMenu extends React.Component { const hostingSignupIFrame = SdkConfig.get().hosting_signup_iframe; let hostingIFrame; if (hostingSignupIFrame) { - hostingIFrame =
- -
; + // If hosting_signup_domains is set to a non-empty array, only show + // dialog if the user is on the domain or a subdomain. + const hostingSignupDomains = SdkConfig.get().hosting_signup_domains || []; + const mxDomain = MatrixClientPeg.get().getDomain(); + const validDomains = hostingSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`))); + if (!hostingSignupDomains || validDomains.length > 0) { + hostingIFrame =
+ +
; + } } let homeButton = null;