From b0e4e11cd4d6d1de818c8a2283c2b77cc0e3f31b Mon Sep 17 00:00:00 2001 From: Allan Guwatudde Date: Wed, 26 Apr 2023 12:32:01 +0300 Subject: [PATCH] [MM-52236] - Include newsletter opt-in for cloud signups (#23103) --- webapp/channels/src/components/signup/signup.test.tsx | 10 +++++++--- webapp/channels/src/components/signup/signup.tsx | 7 +------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/webapp/channels/src/components/signup/signup.test.tsx b/webapp/channels/src/components/signup/signup.test.tsx index 900e8de8b7..60e4a1cb23 100644 --- a/webapp/channels/src/components/signup/signup.test.tsx +++ b/webapp/channels/src/components/signup/signup.test.tsx @@ -316,15 +316,19 @@ describe('components/signup/Signup', () => { expect(signupContainer).toHaveTextContent('Interested in receiving Mattermost security, product, promotions, and company updates updates via newsletter?Sign up at https://mattermost.com/security-updates/.'); }); - it('should not show any newsletter related opt-in or text for cloud', async () => { + it('should show newsletter related opt-in or text for cloud', async () => { jest.spyOn(useCWSAvailabilityCheckAll, 'default').mockImplementation(() => true); mockLicense = {IsLicensed: 'true', Cloud: 'true'}; - renderWithIntlAndStore( + const {container: signupContainer} = renderWithIntlAndStore( , {}); - expect(() => screen.getByTestId('signup-body-card-form-check-newsletter')).toThrow(); + screen.getByTestId('signup-body-card-form-check-newsletter'); + const checkInput = screen.getByTestId('signup-body-card-form-check-newsletter'); + expect(checkInput).toHaveAttribute('type', 'checkbox'); + + expect(signupContainer).toHaveTextContent('I would like to receive Mattermost security updates via newsletter. By subscribing, I consent to receive emails from Mattermost with product updates, promotions, and company news. I have read the Privacy Policy and understand that I can unsubscribe at any time'); }); }); diff --git a/webapp/channels/src/components/signup/signup.tsx b/webapp/channels/src/components/signup/signup.tsx index 0407a74895..0075949586 100644 --- a/webapp/channels/src/components/signup/signup.tsx +++ b/webapp/channels/src/components/signup/signup.tsx @@ -101,7 +101,7 @@ const Signup = ({onCustomizeHeader}: SignupProps) => { TermsOfServiceLink, PrivacyPolicyLink, } = config; - const {IsLicensed, Cloud} = useSelector(getLicense); + const {IsLicensed} = useSelector(getLicense); const loggedIn = Boolean(useSelector(getCurrentUserId)); const usedBefore = useSelector((state: GlobalState) => (!inviteId && !loggedIn && token ? getGlobalItem(state, token, null) : undefined)); const graphQLEnabled = useSelector(isGraphQLEnabled); @@ -111,7 +111,6 @@ const Signup = ({onCustomizeHeader}: SignupProps) => { const passwordInput = useRef(null); const isLicensed = IsLicensed === 'true'; - const isCloud = Cloud === 'true'; const enableOpenServer = EnableOpenServer === 'true'; const noAccounts = NoAccounts === 'true'; const enableSignUpWithEmail = EnableSignUpWithEmail === 'true'; @@ -579,10 +578,6 @@ const Signup = ({onCustomizeHeader}: SignupProps) => { const handleReturnButtonOnClick = () => history.replace('/'); const getNewsletterCheck = () => { - if (isCloud) { - return null; - } - if (canReachCWS) { return (