Skip to content

Commit e5360dc

Browse files
authored
fix: allow users who can create orgs to see the full list of orgs when creating a course [FC-0076] (#1689)
The fixes for #1577 caused issues with edx.org's Global Staff users not being able to create courses. edx.org/2U Global Staff are seeing an empty Organization drop-down list. This issue arose due to misuse of two similarly-named flags returned by the contentstore's home API * `can_create_organizations`: granted to Global Staff or everyone if `FEATURES[ENABLE_CREATOR_GROUP] == True`, * `allow_to_create_new_org`: which is actually about auto-creating organizations, so both `can_create_organizations` + `settings.ORGANIZATIONS_AUTOCREATE` must be True In this change, we use `canCreateOrganizations` to decide whether the user can see the full list of organizations when creating courses. We preserve the use of `allowToCreateNewOrg` when deciding whether to allow users to "typeahead" to create a new organization not in the drop-down list.
1 parent 11a7e78 commit e5360dc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/generic/create-or-rerun-course/hooks.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ const useCreateOrRerunCourse = (initialValues) => {
2727
const allOrganizations = useSelector(getOrganizations);
2828
const postErrors = useSelector(getPostErrors);
2929
const {
30-
allowToCreateNewOrg,
30+
canCreateOrganizations,
3131
allowedOrganizations,
3232
} = useSelector(getStudioHomeData);
3333
const [isFormFilled, setFormFilled] = useState(false);
3434
const [showErrorBanner, setShowErrorBanner] = useState(false);
35-
const organizations = allowToCreateNewOrg ? allOrganizations : allowedOrganizations;
35+
const organizations = canCreateOrganizations ? allOrganizations : allowedOrganizations;
3636

3737
const { specialCharsRule, noSpaceRule } = REGEX_RULES;
3838
const validationSchema = Yup.object().shape({
@@ -78,7 +78,7 @@ const useCreateOrRerunCourse = (initialValues) => {
7878
});
7979

8080
useEffect(() => {
81-
if (allowToCreateNewOrg) {
81+
if (canCreateOrganizations) {
8282
dispatch(fetchOrganizationsQuery());
8383
}
8484
}, []);

src/studio-home/__mocks__/studioHomeMock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
cmsLink: '//localhost:18010/courses/course-v1:Design+123+e.g.2025',
2727
},
2828
],
29-
canCreateOrganizations: true,
29+
canCreateOrganizations: false,
3030
courseCreatorStatus: 'granted',
3131
courses: [
3232
{

0 commit comments

Comments
 (0)