Merge pull request #4097 from LLK/hotfix/remove-opt-in

[Develop] remove email opt-in from join flow
This commit is contained in:
Benjamin Wheeler 2020-06-15 13:09:10 -04:00 committed by GitHub
commit 2bf0071b3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 32 deletions

View file

@ -9,7 +9,6 @@ const FormattedMessage = require('react-intl').FormattedMessage;
const validate = require('../../lib/validate'); const validate = require('../../lib/validate');
const JoinFlowStep = require('./join-flow-step.jsx'); const JoinFlowStep = require('./join-flow-step.jsx');
const FormikInput = require('../../components/formik-forms/formik-input.jsx'); const FormikInput = require('../../components/formik-forms/formik-input.jsx');
const FormikCheckbox = require('../../components/formik-forms/formik-checkbox.jsx');
const InfoButton = require('../info-button/info-button.jsx'); const InfoButton = require('../info-button/info-button.jsx');
const Captcha = require('../../components/captcha/captcha.jsx'); const Captcha = require('../../components/captcha/captcha.jsx');
require('./join-flow-steps.scss'); require('./join-flow-steps.scss');
@ -100,8 +99,7 @@ class EmailStep extends React.Component {
return ( return (
<Formik <Formik
initialValues={{ initialValues={{
email: '', email: ''
subscribe: false
}} }}
validate={this.validateForm} validate={this.validateForm}
validateOnBlur={false} validateOnBlur={false}
@ -186,13 +184,6 @@ class EmailStep extends React.Component {
message={this.props.intl.formatMessage({id: 'registration.emailStepInfo'})} message={this.props.intl.formatMessage({id: 'registration.emailStepInfo'})}
/> />
</div> </div>
<div className="join-flow-email-checkbox-row">
<FormikCheckbox
id="subscribeCheckbox"
label={this.props.intl.formatMessage({id: 'registration.receiveEmails'})}
name="subscribe"
/>
</div>
<Captcha <Captcha
ref={this.setCaptchaRef} ref={this.setCaptchaRef}
onCaptchaError={this.props.onCaptchaError} onCaptchaError={this.props.onCaptchaError}

View file

@ -194,7 +194,6 @@ class JoinFlow extends React.Component {
'g-recaptcha-response': formData['g-recaptcha-response'], 'g-recaptcha-response': formData['g-recaptcha-response'],
'gender': formData.gender, 'gender': formData.gender,
'country': formData.country, 'country': formData.country,
'subscribe': true,
'is_robot': formData.yesno 'is_robot': formData.yesno
// no need to include csrfmiddlewaretoken; will be provided in // no need to include csrfmiddlewaretoken; will be provided in
// X-CSRFToken header, which scratchr2 looks for in // X-CSRFToken header, which scratchr2 looks for in

View file

@ -184,7 +184,7 @@
"registration.genderOptionAnother": "Another gender:", "registration.genderOptionAnother": "Another gender:",
"registration.genderOptionPreferNotToSay": "Prefer not to say", "registration.genderOptionPreferNotToSay": "Prefer not to say",
"registration.emailStepTitle": "What's your email?", "registration.emailStepTitle": "What's your email?",
"registration.emailStepInfo": "This will help if you forget your password, or if you want to receive email updates. This information will not be made public on your account.", "registration.emailStepInfo": "This will help if you forget your password. This information will not be made public on your account.",
"registration.goToClass": "Go to Class", "registration.goToClass": "Go to Class",
"registration.invitedBy": "invited by", "registration.invitedBy": "invited by",
"registration.lastStepTitle": "Thank you for requesting a Scratch Teacher Account", "registration.lastStepTitle": "Thank you for requesting a Scratch Teacher Account",
@ -201,7 +201,6 @@
"registration.personalStepDescription": "Your individual responses will not be displayed publicly, and will be kept confidential and secure", "registration.personalStepDescription": "Your individual responses will not be displayed publicly, and will be kept confidential and secure",
"registration.private": "We will keep this information private.", "registration.private": "We will keep this information private.",
"registration.problemsAre": "The problems are:", "registration.problemsAre": "The problems are:",
"registration.receiveEmails": "I'd like to receive emails from the Scratch Team about project ideas, events, and more.",
"registration.selectCountry": "Select country", "registration.selectCountry": "Select country",
"registration.startOverInstruction": "Click \"Start over.\"", "registration.startOverInstruction": "Click \"Start over.\"",
"registration.studentPersonalStepDescription": "This information will not appear on the Scratch website.", "registration.studentPersonalStepDescription": "This information will not appear on the Scratch website.",

View file

@ -3,7 +3,6 @@ const {shallowWithIntl} = require('../../helpers/intl-helpers.jsx');
const {mountWithIntl} = require('../../helpers/intl-helpers.jsx'); const {mountWithIntl} = require('../../helpers/intl-helpers.jsx');
const JoinFlowStep = require('../../../src/components/join-flow/join-flow-step.jsx'); const JoinFlowStep = require('../../../src/components/join-flow/join-flow-step.jsx');
const FormikInput = require('../../../src/components/formik-forms/formik-input.jsx'); const FormikInput = require('../../../src/components/formik-forms/formik-input.jsx');
const FormikCheckbox = require('../../../src/components/formik-forms/formik-checkbox.jsx');
const requestSuccessResponse = { const requestSuccessResponse = {
requestSucceeded: true, requestSucceeded: true,
@ -49,7 +48,6 @@ describe('EmailStep test', () => {
{...defaultProps()} {...defaultProps()}
/>); />);
const emailStepWrapper = intlWrapper.dive(); const emailStepWrapper = intlWrapper.dive();
expect(emailStepWrapper.props().initialValues.subscribe).toBe(false);
expect(emailStepWrapper.props().initialValues.email).toBe(''); expect(emailStepWrapper.props().initialValues.email).toBe('');
expect(emailStepWrapper.props().validateOnBlur).toBe(false); expect(emailStepWrapper.props().validateOnBlur).toBe(false);
expect(emailStepWrapper.props().validateOnChange).toBe(false); expect(emailStepWrapper.props().validateOnChange).toBe(false);
@ -94,23 +92,6 @@ describe('EmailStep test', () => {
expect(emailInputWrapper.props().validate).toEqual(emailStepWrapper.instance().validateEmail); expect(emailInputWrapper.props().validate).toEqual(emailStepWrapper.instance().validateEmail);
}); });
test('props sent to FormikCheckbox for subscribe', () => {
const intlWrapper = shallowWithIntl(<EmailStep
{...defaultProps()}
/>);
// Dive to get past the intl wrapper
const emailStepWrapper = intlWrapper.dive();
// Dive to get past the anonymous component.
const joinFlowWrapper = emailStepWrapper.dive().find(JoinFlowStep);
expect(joinFlowWrapper).toHaveLength(1);
const checkboxWrapper = joinFlowWrapper.find(FormikCheckbox).first();
expect(checkboxWrapper).toHaveLength(1);
expect(checkboxWrapper.first().props().id).toEqual('subscribeCheckbox');
expect(checkboxWrapper.first().props().label).toEqual('registration.receiveEmails');
expect(checkboxWrapper.first().props().name).toEqual('subscribe');
});
test('handleValidSubmit passes formData to next step', () => { test('handleValidSubmit passes formData to next step', () => {
const formikBag = { const formikBag = {
setSubmitting: jest.fn() setSubmitting: jest.fn()