Skip to content

Commit

Permalink
chore: removed reported_content_email_notifications_flag dependency (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ayesha-waris authored Jan 5, 2024
1 parent 2e070c9 commit 2205506
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const OpenedXConfigForm = ({
unitLevelVisibility: true,
allowAnonymousPostsPeers: appConfigObj?.allowAnonymousPostsPeers || false,
reportedContentEmailNotifications: appConfigObj?.reportedContentEmailNotifications || false,
enableReportedContentEmailNotifications: Boolean(appConfigObj?.enableReportedContentEmailNotifications) || false,
restrictedDates: appConfigObj?.restrictedDates || [],
discussionTopics: discussionTopicsModel || [],
divideByCohorts: appConfigObj?.divideByCohorts || false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const defaultAppConfig = (divideDiscussionIds = []) => ({
allowAnonymousPosts: false,
allowAnonymousPostsPeers: false,
reportedContentEmailNotifications: false,
enableReportedContentEmailNotifications: false,
allowDivisionByUnit: false,
restrictedDates: [],
cohortsEnabled: false,
Expand Down Expand Up @@ -141,7 +140,6 @@ describe('OpenedXConfigForm', () => {
...legacyApiResponse,
plugin_configuration: {
...legacyApiResponse.plugin_configuration,
reported_content_email_notifications_flag: true,
divided_course_wide_discussions: [],
available_division_schemes: [],
},
Expand Down Expand Up @@ -181,7 +179,6 @@ describe('OpenedXConfigForm', () => {
...legacyApiResponse.plugin_configuration,
allow_anonymous: true,
reported_content_email_notifications: true,
reported_content_email_notifications_flag: true,
always_divide_inline_discussions: true,
divided_course_wide_discussions: [],
available_division_schemes: ['cohorts'],
Expand Down Expand Up @@ -222,7 +219,6 @@ describe('OpenedXConfigForm', () => {
...legacyApiResponse.plugin_configuration,
allow_anonymous: true,
reported_content_email_notifications: true,
reported_content_email_notifications_flag: true,
always_divide_inline_discussions: true,
divided_course_wide_discussions: ['13f106c6-6735-4e84-b097-0456cff55960', 'course'],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,19 @@ const ReportedContentEmailNotifications = ({ intl }) => {
} = useFormikContext();

return (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{values.enableReportedContentEmailNotifications && (
<div>
<h5 className="text-gray-500 mt-4 mb-2 ">{intl.formatMessage(messages.reportedContentEmailNotifications)}</h5>
<FormSwitchGroup
className="mb-4"
onChange={handleChange}
onBlur={handleBlur}
id="reportedContentEmailNotifications"
checked={values.reportedContentEmailNotifications}
label={intl.formatMessage(messages.reportedContentEmailNotificationsLabel)}
helpText={intl.formatMessage(messages.reportedContentEmailNotificationsHelp)}
/>
<AppConfigFormDivider thick />
</div>
)}
</>
<div>
<h5 className="text-gray-500 mt-4 mb-2 ">{intl.formatMessage(messages.reportedContentEmailNotifications)}</h5>
<FormSwitchGroup
className="mb-4"
onChange={handleChange}
onBlur={handleBlur}
id="reportedContentEmailNotifications"
checked={values.reportedContentEmailNotifications}
label={intl.formatMessage(messages.reportedContentEmailNotificationsLabel)}
helpText={intl.formatMessage(messages.reportedContentEmailNotificationsHelp)}
/>
<AppConfigFormDivider thick />
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const appConfig = {
allowAnonymousPosts: false,
allowAnonymousPostsPeers: false,
reportedContentEmailNotifications: false,
enableReportedContentEmailNotifications: false,
allowDivisionByUnit: false,
restrictedDates: [],
};
Expand Down
1 change: 0 additions & 1 deletion src/pages-and-resources/discussions/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ function normalizePluginConfig(data) {
allowAnonymousPosts: data.allow_anonymous,
allowAnonymousPostsPeers: data.allow_anonymous_to_peers,
reportedContentEmailNotifications: data.reported_content_email_notifications,
enableReportedContentEmailNotifications: data.reported_content_email_notifications_flag,
divisionScheme: data.division_scheme,
alwaysDivideInlineDiscussions: data.always_divide_inline_discussions,
restrictedDates: normalizeRestrictedDates(data.discussion_blackouts),
Expand Down
1 change: 0 additions & 1 deletion src/pages-and-resources/discussions/data/redux.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ describe('Data layer integration tests', () => {
allowAnonymousPosts: false,
allowAnonymousPostsPeers: false,
reportedContentEmailNotifications: false,
enableReportedContentEmailNotifications: false,
restrictedDates: [],
// TODO: Note! As of this writing, all the data below this line is NOT returned in the API
// but we add it in during normalization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export const generateLegacyApiResponse = () => ({
allow_anonymous: false,
allow_anonymous_to_peers: false,
reported_content_email_notifications: false,
reported_content_email_notifications_flag: false,
always_divide_inline_discussions: false,
available_division_schemes: ['enrollment_track'],
discussion_topics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('<PacingSection />', () => {
});

it('shows disabled radio inputs correctly', () => {
const pastDate = '2023-12-31';
const pastDate = '2024-12-31';
const initialProps = { ...props, startDate: pastDate };
const { getAllByRole, queryAllByText } = render(
<RootWrapper {...initialProps} />,
Expand Down

0 comments on commit 2205506

Please sign in to comment.