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

Create the moderation decision model #3989

Merged
merged 18 commits into from Apr 3, 2024
Merged

Create the moderation decision model #3989

merged 18 commits into from Apr 3, 2024

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Mar 31, 2024

Fixes

Fixes #3636 by @sarayourfriend

Description

This PR

  • adds the moderation decision models (abstract and concrete for both media types)
  • adds a decision field on the report models
  • deprecates the status field on the report models to use the decision model
  • updates the admin UI for reports to account for changed fields
  • refactors code to reduce duplication by moving common code to parent class
  • fixes a validation issue in the AbstractMediaReport model (and update tests)

Note

The model uses some different names to match the naming scheme used by other API models. These are small, positive changes and should not block merge.

Testing Instructions

  1. Check out the PR and run the dev server.
  2. Observe the admin views for the reports and decisions.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@dhruvkb dhruvkb added 🟨 priority: medium Not blocking but should be addressed soon 🌟 goal: addition Addition of new feature 💻 aspect: code Concerns the software code in the repository 🧱 stack: api Related to the Django API labels Mar 31, 2024
@github-actions github-actions bot added the migrations Modifications to Django migrations label Mar 31, 2024
@WordPress WordPress deleted a comment from github-actions bot Mar 31, 2024
@dhruvkb dhruvkb marked this pull request as ready for review April 1, 2024 18:13
@dhruvkb dhruvkb requested a review from a team as a code owner April 1, 2024 18:13
@dhruvkb dhruvkb requested review from krysal and stacimc April 1, 2024 18:13
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

Looks pretty good so far, but I have two significant requests for changes:

  1. Lets use full-names for the decision reason slugs, unless there's a really good reason not to that I am not seeing. If that is the case, then please document the reason in code.
  2. We need to stick to standard Django tools for URL building, and should use request.build_absolute_uri for consistent and correct behaviour for each requester.

api/api/constants/moderation.py Outdated Show resolved Hide resolved
api/api/models/media.py Outdated Show resolved Hide resolved
api/api/models/media.py Outdated Show resolved Hide resolved
@WordPress WordPress deleted a comment from github-actions bot Apr 2, 2024
Co-authored-by: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com>
@WordPress WordPress deleted a comment from github-actions bot Apr 2, 2024
@WordPress WordPress deleted a comment from github-actions bot Apr 2, 2024
@AetherUnbound AetherUnbound added 🟧 priority: high Stalls work on the project or its dependents and removed 🟨 priority: medium Not blocking but should be addressed soon labels Apr 2, 2024
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

The model and associated changes all look good! I was able to run the app successfully locally.

api/api/constants/moderation.py Outdated Show resolved Hide resolved
api/api/models/media.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM! Just one suggestion to leave out the is_moderated property until we need it (or maybe even just in preference of using not is_pending as a clearer and "only one obvious way").

api/api/models/media.py Outdated Show resolved Hide resolved
Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
@WordPress WordPress deleted a comment from github-actions bot Apr 3, 2024
@WordPress WordPress deleted a comment from github-actions bot Apr 3, 2024
@WordPress WordPress deleted a comment from github-actions bot Apr 3, 2024
Copy link

github-actions bot commented Apr 3, 2024

This PR has migrations. Please rebase it before merging to ensure that conflicting migrations are not introduced.

@dhruvkb dhruvkb merged commit 2bd852c into main Apr 3, 2024
42 checks passed
@dhruvkb dhruvkb deleted the moderation_decision branch April 3, 2024 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature migrations Modifications to Django migrations 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Create ModerationDecision table
3 participants