Skip to content

feat: implement tag object rest api in cms - #33181

Merged
bradenmacdonald merged 29 commits into
openedx:masterfrom
open-craft:rpenido/fal-3449-implement_tag_object_rest_api_in_cms
Sep 18, 2023
Merged

feat: implement tag object rest api in cms#33181
bradenmacdonald merged 29 commits into
openedx:masterfrom
open-craft:rpenido/fal-3449-implement_tag_object_rest_api_in_cms

Conversation

@rpenido

@rpenido rpenido commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

Description

This PR implements the tagging REST API for creating/updating object tags in Courses and XBlocks.

Supporting Information

Testing instructions

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

Private ref: FAL-3499

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 5, 2023
@openedx-webhooks

openedx-webhooks commented Sep 5, 2023

Copy link
Copy Markdown

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.

Comment thread requirements/edx/kernel.in Outdated
openedx-filters # Open edX Filters from Hooks Extension Framework (OEP-50)
openedx-learning # Open edX Learning core (experimental)
# openedx-learning # Open edX Learning core (experimental)
openedx-learning @ git+https://github.com/openedx/openedx-learning@main # Remove this once openedx-learning is tagged

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bradenmacdonald could you please create a tag to deploy the new version of openedx-learning?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, done. We'll need to merge this PR soon because v0.1.6 has a breaking change:

   File "/openedx/edx-platform/openedx/features/content_tagging/rules.py", line 99, in <module>
     def can_change_object_tag(user: User, object_tag: oel_tagging.ObjectTag = None) -> bool:
 AttributeError: module 'openedx_tagging.core.tagging.rules' has no attribute 'ObjectTag'

@rpenido rpenido Sep 15, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm pinning the version to avoid unwanted updates while openedx-learning is in development/unstable.
Does that make sense? bb18095

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes that makes sense.

@ChrisChV ChrisChV left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rpenido Looks good 👍 . I think we can reduce some boilerplate on test_rules.py. I added some other comments too.

  • I read through the code
  • I ran the tests

Comment thread openedx/features/content_tagging/rest_api/v1/tests/test_views.py Outdated
rules.set_perm("oel_tagging.view_object_tag", rules.always_allow)

# Users can tag objects using tags from any taxonomy that they have permission to view
rules.set_perm("oel_tagging.change_objecttag_taxonomy", can_change_object_tag_taxonomy)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rpenido Could you update the comments here to give the information that this perms are used on openedx_tagging. A developer who doesn't know this can get lost here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done 33dafac

("oel_tagging.add_object_tag", "tax_both_course1"),
("oel_tagging.add_object_tag", "tax_both_course2"),
("oel_tagging.add_object_tag", "tax_both_xblock1"),
("oel_tagging.add_object_tag", "tax_both_xblock2"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rpenido Maybe to avoid this boilerplate, you can have an static list of all tag_attr (are the same for the three perms) and only leave the three perms on the ddt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done 7eb4139

Let me know if I got it right!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yep, Thanks!

@rpenido rpenido changed the title feat: implement tag object rest api in cms WIP feat: implement tag object rest api in cms Sep 13, 2023

@bradenmacdonald bradenmacdonald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would prefer to see a test or two that actually uses the REST API to change the tags of a component, where it works if the user has edit permission on the course and returns 403 if the user doesn't have edit permission on that course.

Also, we need to update the dependency to use the new tag v0.1.6 that I just published. Otherwise, this looks good! I can merge tomorrow.

@rpenido
rpenido force-pushed the rpenido/fal-3449-implement_tag_object_rest_api_in_cms branch 2 times, most recently from 2763102 to 03d51ab Compare September 15, 2023 11:56
@rpenido
rpenido force-pushed the rpenido/fal-3449-implement_tag_object_rest_api_in_cms branch from 03d51ab to 52c529b Compare September 15, 2023 11:57
@rpenido

rpenido commented Sep 15, 2023

Copy link
Copy Markdown
Contributor Author

Hello @bradenmacdonald! How are you doing?

I would prefer to see a test or two that actually uses the REST API to change the tags of a component, where it works if the user has edit permission on the course and returns 403 if the user doesn't have edit permission on that course.

Done 64107d1

Also, we need to update the dependency to use the new tag v0.1.6 that I just published. Otherwise, this looks good! I can merge tomorrow.

Done 52c529b

@rpenido
rpenido force-pushed the rpenido/fal-3449-implement_tag_object_rest_api_in_cms branch from 1822ed9 to bb18095 Compare September 15, 2023 12:06
@rpenido

rpenido commented Sep 18, 2023

Copy link
Copy Markdown
Contributor Author

Hi @bradenmacdonald!

Is there something I can do to help this get merged?

Thank you!

@bradenmacdonald

Copy link
Copy Markdown
Contributor

@rpenido I'll merge it today.

@bradenmacdonald
bradenmacdonald merged commit 3c3306c into openedx:master Sep 18, 2023
@bradenmacdonald
bradenmacdonald deleted the rpenido/fal-3449-implement_tag_object_rest_api_in_cms branch September 18, 2023 18:07
@openedx-webhooks

Copy link
Copy Markdown

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

@edx-pipeline-bot

Copy link
Copy Markdown
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
Copy Markdown
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.

[Tagging] Implement tagging REST API: Update content object tags

5 participants