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

Tagging: serialize object permissions to REST API [FC-0036] #34004

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

pomegranited
Copy link
Contributor

@pomegranited pomegranited commented Jan 4, 2024

Description

Updates the installed version of openedx-learning and relevant tests to use the updated REST API serializers in openedx/openedx-learning#138.

The Tagging feature is disabled in edX/2U production, so this change should not impact anyone.

Supporting information

Part of openedx/modular-learning#160

Testing instructions

See openedx/frontend-app-authoring#787 for manual testing instructions.

Deadline

None

Other information

Depends on:

Private ref: FAL-3577

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jan 4, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Jan 4, 2024

Thanks for the pull request, @pomegranited! 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.

@pomegranited pomegranited force-pushed the jill/tagging-rest-perms branch 3 times, most recently from 8359e78 to 0c070c8 Compare January 11, 2024 06:53
@pomegranited pomegranited force-pushed the jill/tagging-rest-perms branch 2 times, most recently from 5a820ef to 9db5e18 Compare January 14, 2024 23:46
@pomegranited pomegranited marked this pull request as ready for review January 15, 2024 06:40
@pomegranited pomegranited requested a review from rpenido January 15, 2024 06:40
Copy link
Contributor

@rpenido rpenido left a comment

Choose a reason for hiding this comment

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

This is looking good @pomegranited!
Good work also fixing the types.

I added a comment about the can_change_object_tag_objectid function.

@@ -219,7 +219,7 @@ def can_change_object_tag_objectid(user: UserType, object_id: str) -> bool:
Everyone that has permission to edit the object should be able to tag it.
"""
if not object_id:
raise ValueError("object_id must be provided")
return True
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use change_objecttag_taxonomy at openedx-learning, we don't need to change it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted, please see my reply.

Comment on lines +506 to +498
with self.assertNumQueries(16): # TODO Why so many queries?
response = self.client.get(url)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added TODO statements marking these query counts, since they're awfully high. But fixing them is out of scope for this task -- here, I only needed to verify that adding permissions to the response doesn't add to the query count.

Copy link
Contributor

@rpenido rpenido Jan 17, 2024

Choose a reason for hiding this comment

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

Out of curiosity, did you discover if it was related to the permissions?
I now we get the Org list and tag count (I'm not sure if in the same query that we get the Taxonomy)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, the extra queries seem to be the ones for getting the user orgs and matching them with the taxonomies.

Copy link
Contributor

@bradenmacdonald bradenmacdonald Jan 24, 2024

Choose a reason for hiding this comment

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

Sounds like we're missing a select_related somewhere.

@rpenido rpenido self-requested a review January 17, 2024 13:33
Copy link
Contributor

@rpenido rpenido left a comment

Choose a reason for hiding this comment

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

Good work @pomegranited! 👍

ToDo: update requirements after merge:

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

If you can confirm that the high query counts you flagged are not related to the permissions changes, this LGTM. I can merge tomorrow.

Would you mind creating a ticket on the modular learning board on GitHub to investigate those query counts, and ping me on it?

@pomegranited
Copy link
Contributor Author

@bradenmacdonald

If you can confirm that the high query counts you flagged are not related to the permissions changes, this LGTM. I can merge tomorrow.

Confirmed. My apologies, I squashed out the commits that demonstrated the query counts were unchanged with and without calculating those permission flags in the response. If there had been a difference, I would have kept that include_perms query parameter.

Thank you for your help merging this!

Would you mind creating a ticket on the modular learning board on GitHub to investigate those query counts, and ping me on it?

Created openedx/modular-learning#185, but wasn't sure which milestone to attach it to.

@bradenmacdonald bradenmacdonald merged commit 7535f9d into openedx:master Jan 25, 2024
64 checks passed
@bradenmacdonald bradenmacdonald deleted the jill/tagging-rest-perms branch January 25, 2024 18:12
@openedx-webhooks
Copy link

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

@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
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.

5 participants