feat: remove primary/elementary option from education

If COPPA compliance feature flag is enabled, remove the `primary/elementary` option
from the level of education dropdown field on edit but keep the value showing for
the users who have already selected it.

VAN-762
This commit is contained in:
Waheed Ahmed
2021-10-27 14:10:57 +05:00
parent 112ddf80e6
commit 4b4f29ae19
6 changed files with 11 additions and 6 deletions

View File

@@ -583,7 +583,7 @@ class AccountSettingsPage extends React.Component {
/>
{this.renderSecondaryEmailField(editableFieldProps)}
<ResetPassword email={this.props.formValues.email} />
{(getConfig().COLLECT_YEAR_OF_BIRTH === 'true')
{(!getConfig().ENABLE_COPPA_COMPLIANCE)
&& (
<EditableField
name="year_of_birth"

View File

@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { getConfig } from '@edx/frontend-platform';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import {
Button, Input, StatefulButton, ValidationFormGroup,
@@ -43,6 +44,10 @@ function EditableField(props) {
...others
} = props;
const id = `field-${name}`;
let inputOptions = options;
if (getConfig().ENABLE_COPPA_COMPLIANCE && name === 'level_of_education' && options) {
inputOptions = options.filter(option => option.value !== 'el');
}
const handleSubmit = (e) => {
e.preventDefault();
@@ -120,7 +125,7 @@ function EditableField(props) {
type={type}
value={value}
onChange={handleChange}
options={options}
options={inputOptions}
{...others}
/>
<>{others.children}</>

View File

@@ -63,7 +63,7 @@ initialize({
COACHING_ENABLED: (process.env.COACHING_ENABLED || false),
ENABLE_DEMOGRAPHICS_COLLECTION: (process.env.ENABLE_DEMOGRAPHICS_COLLECTION || false),
DEMOGRAPHICS_BASE_URL: process.env.DEMOGRAPHICS_BASE_URL,
COLLECT_YEAR_OF_BIRTH: (process.env.COLLECT_YEAR_OF_BIRTH || true),
ENABLE_COPPA_COMPLIANCE: (process.env.ENABLE_COPPA_COMPLIANCE || false),
}, 'App loadConfig override handler');
},
},