From a0489e03ab2818c20d7ee2e5eb8368e9a99d59bd Mon Sep 17 00:00:00 2001 From: Mehak Nasir <67791278+mehaknasir@users.noreply.github.com> Date: Thu, 14 Apr 2022 13:18:09 +0500 Subject: [PATCH] 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 --- .../apps/openedx/OpenedXConfigForm.jsx | 1 - .../apps/openedx/OpenedXConfigForm.test.jsx | 7 ++--- .../apps/shared/AnonymousPostingFields.jsx | 27 ++++--------------- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.jsx b/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.jsx index d5ffd512f..71ea26f9e 100644 --- a/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.jsx +++ b/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.jsx @@ -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, diff --git a/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.test.jsx b/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.test.jsx index 5afae3e73..aceae0aff 100644 --- a/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.test.jsx +++ b/src/pages-and-resources/discussions/app-config-form/apps/openedx/OpenedXConfigForm.test.jsx @@ -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(); diff --git a/src/pages-and-resources/discussions/app-config-form/apps/shared/AnonymousPostingFields.jsx b/src/pages-and-resources/discussions/app-config-form/apps/shared/AnonymousPostingFields.jsx index f297900f4..7eb160ed7 100644 --- a/src/pages-and-resources/discussions/app-config-form/apps/shared/AnonymousPostingFields.jsx +++ b/src/pages-and-resources/discussions/app-config-form/apps/shared/AnonymousPostingFields.jsx @@ -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 ( <>
{intl.formatMessage(messages.anonymousPosting)}
+ - - {values.allowAnonymousPosts ? ( - - - - - ) : } - ); } @@ -48,7 +32,6 @@ AnonymousPostingFields.propTypes = { onChange: PropTypes.func.isRequired, intl: intlShape.isRequired, values: PropTypes.shape({ - allowAnonymousPosts: PropTypes.bool, allowAnonymousPostsPeers: PropTypes.bool, }).isRequired, };