feat: removed the support of allow anonymous to all from discussion configs (#284)

* feat: removed the support of allow anonymous to all from discussion configs

* fix: test cases fix after rebase
This commit is contained in:
Mehak Nasir
2022-04-14 13:18:09 +05:00
committed by GitHub
parent e0680636c5
commit a0489e03ab
3 changed files with 7 additions and 28 deletions

View File

@@ -35,7 +35,6 @@ function OpenedXConfigForm({
enableInContext,
enableGradedUnits,
unitLevelVisibility,
allowAnonymousPosts: appConfigObj?.allowAnonymousPosts || false,
allowAnonymousPostsPeers: appConfigObj?.allowAnonymousPostsPeers || false,
reportedContentEmailNotifications: appConfigObj?.reportedContentEmailNotifications || false,
enableReportedContentEmailNotifications: appConfigObj?.enableReportedContentEmailNotifications || false,

View File

@@ -157,11 +157,10 @@ describe('OpenedXConfigForm', () => {
).not.toBeInTheDocument());
// AnonymousPostingFields
expect(container.querySelector('#allowAnonymousPosts')).toBeInTheDocument();
expect(container.querySelector('#allowAnonymousPosts')).not.toBeChecked();
expect(
container.querySelector('#allowAnonymousPostsPeers'),
).not.toBeInTheDocument();
).toBeInTheDocument();
expect(container.querySelector('#allowAnonymousPostsPeers')).not.toBeChecked();
// ReportedContentEmailNotifications
expect(container.querySelector('#reportedContentEmailNotifications')).toBeInTheDocument();
@@ -201,8 +200,6 @@ describe('OpenedXConfigForm', () => {
).not.toBeInTheDocument());
// AnonymousPostingFields
expect(container.querySelector('#allowAnonymousPosts')).toBeInTheDocument();
expect(container.querySelector('#allowAnonymousPosts')).toBeChecked();
expect(
container.querySelector('#allowAnonymousPostsPeers'),
).toBeInTheDocument();

View File

@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { TransitionReplace } from '@edx/paragon';
import FormSwitchGroup from '../../../../../generic/FormSwitchGroup';
import messages from '../../messages';
import AppConfigFormDivider from './AppConfigFormDivider';
@@ -15,30 +14,15 @@ function AnonymousPostingFields({
return (
<>
<h5 className="mt-4 text-gray-500">{intl.formatMessage(messages.anonymousPosting)}</h5>
<AppConfigFormDivider />
<FormSwitchGroup
onChange={onChange}
onBlur={onBlur}
id="allowAnonymousPosts"
checked={values.allowAnonymousPosts}
label={intl.formatMessage(messages.allowAnonymousPostsLabel)}
helpText={intl.formatMessage(messages.allowAnonymousPostsHelp)}
id="allowAnonymousPostsPeers"
checked={values.allowAnonymousPostsPeers}
label={intl.formatMessage(messages.allowAnonymousPostsPeersLabel)}
helpText={intl.formatMessage(messages.allowAnonymousPostsPeersHelp)}
/>
<TransitionReplace>
{values.allowAnonymousPosts ? (
<React.Fragment key="open">
<AppConfigFormDivider />
<FormSwitchGroup
onChange={onChange}
onBlur={onBlur}
className="ml-4"
id="allowAnonymousPostsPeers"
checked={values.allowAnonymousPostsPeers}
label={intl.formatMessage(messages.allowAnonymousPostsPeersLabel)}
helpText={intl.formatMessage(messages.allowAnonymousPostsPeersHelp)}
/>
</React.Fragment>
) : <React.Fragment key="closed" />}
</TransitionReplace>
</>
);
}
@@ -48,7 +32,6 @@ AnonymousPostingFields.propTypes = {
onChange: PropTypes.func.isRequired,
intl: intlShape.isRequired,
values: PropTypes.shape({
allowAnonymousPosts: PropTypes.bool,
allowAnonymousPostsPeers: PropTypes.bool,
}).isRequired,
};