[MM-52236] - Include newsletter opt-in for cloud signups (#23103)

This commit is contained in:
Allan Guwatudde 2023-04-26 12:32:01 +03:00 committed by GitHub
parent f079f3ba8d
commit b0e4e11cd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -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(
<BrowserRouter>
<Signup/>
</BrowserRouter>, {});
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');
});
});

View File

@ -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<HTMLInputElement>(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 (
<CheckInput