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

Articles "trash" feature #2037

Merged
merged 8 commits into from
Sep 18, 2024
Merged

Conversation

caiosba
Copy link
Contributor

@caiosba caiosba commented Sep 14, 2024

Description

Allow articles (explainers and fact-checks) to be sent to / restored from the trash.

Steps:

  • Add a trashed attribute to database, GraphQL type and GraphQL update mutation for explainers and fact-checks
  • Add a trashed filter to articles queries, which is false by default
  • When a fact-check is trashed, make sure it's detached and unpublished
  • When an explainer is trashed, make sure that it's detached from all items
  • Validate: Can't apply trashed article to item
  • Delete article permanently automatically after 30 days in the trash (Sidekiq scheduled job) (for fact-checks, both the claim and the fact-check must be deleted)
  • Add automated tests

Reference: CV2-5068.

How has this been tested?

Automated tests in order to keep 100% code coverage.

Checklist

  • I have performed a self-review of my own code
  • I have added unit and feature tests, if the PR implements a new feature or otherwise would benefit from additional testing
  • I have added regression tests, if the PR fixes a bug
  • I have added logging, exception reporting, and custom tracing with any additional information required for debugging
  • I considered secure coding practices when writing this code. Any security concerns are noted above.
  • I have commented my code in hard-to-understand areas, if any
  • I have made needed changes to the README
  • My changes generate no new warnings
  • If I added a third party module, I included a rationale for doing so and followed our current guidelines

@caiosba caiosba marked this pull request as ready for review September 17, 2024 01:14
Comment on lines +102 to +103
obj.destroy!
obj.claim_description.destroy! if obj.is_a?(FactCheck)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest to swap the lines as I prefer to destroy the object itself at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@melsawy good catch! I did that before but it had an issue because of the destroy dependency between claim and fact-check.

Copy link
Contributor

@melsawy melsawy left a comment

Choose a reason for hiding this comment

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

Great work Dr Caio
just left a small comment and it's my prefer and you can ignore it

@caiosba caiosba merged commit 63e8684 into develop Sep 18, 2024
10 checks passed
@caiosba caiosba deleted the feature/cv2-4502-articles-trash-action branch September 18, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants