Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add update taxonomy orgs rest api [FC-0036] #33611

Conversation

rpenido
Copy link
Contributor

@rpenido rpenido commented Oct 27, 2023

Description

Add a rest api endpoint to allow taxonomy admins to change the orgs that are linked to a taxonomy

This also adds the orgs from a taxonomy in the serializer used in the list and detail actions.

Supporting Information

Testing instructions

  • Please ensure that the tests cover the expected behavior of the view as described in the related issue.

Private-ref: FAL-3542

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 27, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 27, 2023

Thanks for the pull request, @rpenido! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@rpenido rpenido force-pushed the rpenido/fal-3542-rest-api-to-assign-a-taxonomy-to-organizations branch 3 times, most recently from a2f5f14 to a1a86b1 Compare October 27, 2023 21:00
@rpenido rpenido force-pushed the rpenido/fal-3542-rest-api-to-assign-a-taxonomy-to-organizations branch from a1a86b1 to a0f9e66 Compare October 27, 2023 21:48
Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @rpenido ! I've left some questions about the tests, but let me know if you disagree.


@ddt.data(
(True, ["orgX"], "Using both all_orgs and orgs parameters should throw error"),
(False, None, "Using neither all_orgs or orgs parameter should throw error"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case looks valid to me.. How do we toggle from all_orgs = True to all_orgs = False?

Copy link
Contributor Author

@rpenido rpenido Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must pass the all_orgs=False and an empty orgs (orgs=[]) array. If you think that omitting orgs should have the same effect, let me know!

Personally, I prefer the explicitly orgs=[] way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, as you wish.

@rpenido rpenido marked this pull request as ready for review October 31, 2023 18:31
@open-craft-grove
Copy link

Sandbox deployment successful.

Sandbox LMS is available at pr-33611-139931.staging.do.opencraft.hosting
Sandbox Studio is available at studio.pr-33611-139931.staging.do.opencraft.hosting

@open-craft-grove
Copy link

Sandbox update request received. Deployment will start soon.

@open-craft-grove
Copy link

Sandbox deployment started.

@rpenido rpenido force-pushed the rpenido/fal-3542-rest-api-to-assign-a-taxonomy-to-organizations branch from d0fc470 to 243585a Compare November 1, 2023 20:46
@open-craft-grove
Copy link

Sandbox update request received. Deployment will start soon.

@open-craft-grove
Copy link

Sandbox deployment started.

@open-craft-grove
Copy link

Sandbox deployment successful.

Sandbox LMS is available at pr-33611-139931.staging.do.opencraft.hosting
Sandbox Studio is available at studio.pr-33611-139931.staging.do.opencraft.hosting

@open-craft-grove
Copy link

Sandbox deployment successful.

Sandbox LMS is available at pr-33611-139931.staging.do.opencraft.hosting
Sandbox Studio is available at studio.pr-33611-139931.staging.do.opencraft.hosting

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good, thank you @rpenido !

  • I ran this code on my devstack, but am relying on the tests to verify the actual functionality.
  • I read through the code
  • I checked for accessibility issues N/A
  • Includes documentation
  • Commit structure follows OEP-0051

@rpenido rpenido marked this pull request as draft November 3, 2023 17:19
@rpenido rpenido marked this pull request as ready for review November 3, 2023 20:41
@bradenmacdonald
Copy link
Contributor

If @pomegranited is happy with this, I'll approve and merge on Monday.

# Check that the orgs didn't change
url = TAXONOMY_ORG_DETAIL_URL.format(pk=self.st1.pk)
response = self.client.get(url)
assert response.data["orgs"] == [None]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't have to block merging, but I don't think it's very nice to send ["orgs"] == [None] to the frontend.

We in the backend know this means "all orgs", but the frontend shouldn't have to know this. I'd rather we sent an explicit "all_orgs" flag with the response to indicate this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion @pomegranited!
Done here: e2e8f76

@bradenmacdonald bradenmacdonald added the FC Relates to an Axim Funded Contribution project label Nov 7, 2023
@bradenmacdonald bradenmacdonald changed the title feat: add update taxonomy orgs rest api feat: add update taxonomy orgs rest api [FC-0036] Nov 7, 2023
@bradenmacdonald bradenmacdonald merged commit 4b4e370 into openedx:master Nov 7, 2023
65 checks passed
@bradenmacdonald bradenmacdonald deleted the rpenido/fal-3542-rest-api-to-assign-a-taxonomy-to-organizations branch November 7, 2023 19:24
@openedx-webhooks
Copy link

@rpenido 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@open-craft-grove
Copy link

Sandbox update request received. Deployment will start soon.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Tagging] REST API to assign a taxonomy to organizations
6 participants