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

link the activity log to the ContentDecision so we can backtrack it #22936

Merged

Conversation

eviljeff
Copy link
Member

@eviljeff eviljeff commented Dec 11, 2024

Fixes: mozilla/addons#15228

Description

Adds an intermediary ActivityLog model that allows us to track ContentDecision that are linked to a reviewer/moderator activity.

Most of the change here is to enable all actions from Cinder to generate an ActivityLog and link the decision to it. The change in notify_reviewer_decision, that is called from the reviewer tools, is more of an intermediate hack because the activity log was already created - it's going to need more refactoring to create the ContentDecision earlier that will be addressed in other issues.

Context

Having a link between the ContentDecision and the connected activity will unlock more accurate appeal handling (we can flag the exact version that was rejected, rather than guessing at the add-on level); and the 2nd level approvals for reviewer tools actions. (And potentially drop CinderJobLog and/or CinderPolicyLog as the ContentDecision already links to jobs and policies)

Testing

Difficult to test functionally because it's a dependency for further work, (on top of the usual fun for testing Cinder integration).

To test Cinder actions:

  • Enable all the Cinder/DSA related waffle switches
  • Report an add-on (or other content) to Cinder
  • Resolve the job in Cinder with a policy that takes down the content
  • replay the webhook payload locally
  • See the content is deleted/disabled
  • Check the latest ActivityLog (it should be the latest, but you may have to dig a little) and see it has a .contentdecisionlog_set manager with 1 ContentDecisionLog instance, where the .decision points to the created CinderDecision.

Bonus testing with appeals:

  • appeal the takedown as the content owner (e.g. add-on developer)
  • grant the appeal in Cinder (for addons the appeal will be in the T&S Escalations queue)
  • replay the webhook payload locally
  • see the content is re-enabled
  • Check the latest ActivityLog (it should be the latest) and see it has a .contentdecisionlog_set manager with 1 ContentDecisionLog instance, where the .decision points to the created CinderDecision.

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

This comment was marked as off-topic.

@eviljeff eviljeff marked this pull request as ready for review December 11, 2024 14:27
@eviljeff eviljeff requested review from a team and diox and removed request for a team December 11, 2024 14:50
@eviljeff eviljeff merged commit 67019a0 into mozilla:master Dec 16, 2024
36 checks passed
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.

[Task]: ForeignKey (indirectly) link ContentDecision to ActivityLog
2 participants