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

fix: fixed typo in updateContentTaxonomyTags URL [FC-0036] #815

Merged

Conversation

pomegranited
Copy link
Contributor

@pomegranited pomegranited commented Feb 1, 2024

Description

#787 introduced a bug in the URL used to update content tags, resulting in 404 errors from the backend.

This PR fixes that bug and the related tests.

Testing instructions

Setup:

  1. Create test taxonomies, tags, orgs, and courses with https://github.com/open-craft/taxonomy-sample-data/
  2. Run this PR's branch for course authoring.

Testing Tag Drawer:

  1. Login to Studio as a non-superuser with course authoring permissions.
  2. Visit the Sample Taxonomy Course course-v1:SampleTaxonomyOrg1+STC1+2023_1
  3. Navigate to a Unit
  4. Click "Manage Tags", either from the sidebar or the unit's menu
  5. Add a bunch of tags at various hierarchy levels, and ensure they add as expected.
  6. Delete some tags and ensure they delete as expected.

Internal-ref: FAL-3577

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

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.

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c7aef6e) 90.58% compared to head (6821ebb) 90.58%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #815   +/-   ##
=======================================
  Coverage   90.58%   90.58%           
=======================================
  Files         511      511           
  Lines        8879     8879           
  Branches     1912     1912           
=======================================
  Hits         8043     8043           
  Misses        811      811           
  Partials       25       25           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

LGTM @pomegranited! 👍

  • I tested this using my local tutor stack, following the testing instructions
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

I made a minor suggestion, but if @xitij2000 manages to review this today, I think we are fine without it.

Comment on lines 78 to 80
let url = getContentTaxonomyTagsApiUrl(contentId);
url = `${url}&taxonomy=${taxonomyId}`;
url = `${url}?taxonomy=${taxonomyId}`;
const { data } = await getAuthenticatedHttpClient().put(url, { tags });
Copy link
Contributor

Choose a reason for hiding this comment

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

That way we avoid dealing with direct string manipulation for the URL (and it can handle more complicated things, like arrays in the query string)

  const url = getContentTaxonomyTagsApiUrl(contentId);
  const params = { taxonomy: taxonomyId };  
  const { data } = await getAuthenticatedHttpClient().put(url, { tags }, { params });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah cool, that's nicer.. fixed 6821ebb

@pomegranited
Copy link
Contributor Author

@xitij2000 could you merge this when you're happy with it?

@pomegranited
Copy link
Contributor Author

@xitij2000 I don't think the CI error is related to this change? But please let me know if there's something I need to do to resolve it.

@xitij2000
Copy link
Contributor

@xitij2000 I don't think the CI error is related to this change? But please let me know if there's something I need to do to resolve it.

I'm rerunning the tests and will merge when they pass.

@xitij2000 xitij2000 merged commit 49d4fd4 into openedx:master Feb 2, 2024
6 checks passed
@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.

@xitij2000 xitij2000 deleted the jill/fix-updateContentTaxonomyTags branch February 2, 2024 06:30
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.

4 participants