openedx / openedx-learning

GNU Affero General Public License v3.0
5 stars 8 forks source link

fix: skip parent update from deleted tags #126

Closed rpenido closed 9 months ago

rpenido commented 9 months ago

Description

This PR prevents creating an UpdateParent action associated with a Tag that will be deleted.

Example:

- Tag 1
  - Tag 1.1
    - Tag 1.1.1

Actions before PR:

#1 Delete Tag 1
#2 Delete Tag 1.1
#3 Delete Tag 1.1.1
#4 Update parent tag of Tag 1.1 from Tag 1 to None (** THIS FAILS BECAUSE Tag 1.1 WAS DELETED **)
#5 Update parent tag of Tag 1.1.1 from Tag 1.1 to None  (** THIS FAILS BECAUSE Tag 1.1.1 WAS DELETED **)

Actions after PR:

#1 Delete Tag 1
#2 Delete Tag 1.1
#3 Delete Tag 1.1.1

It also checks if the Tag actually exists in the database before executing the Delete action. In the example above, because we didn't update the parent of tags 1.1 and 1.1.1, actions #2 and #3 should be skipped because both tags were cascade deleted on action #1.

Testing instructions


Private-ref:

openedx-webhooks commented 9 months ago

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:

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.

bradenmacdonald commented 9 months ago

Merging now. I see there's no version bump - let me know if we need to add one at some point, or just wait to combine this with other changes.

openedx-webhooks commented 9 months ago

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