-
Notifications
You must be signed in to change notification settings - Fork 212
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
Make media items the centre for all moderation activity #4386
Conversation
def handle_redis_exception(func): | ||
@functools.wraps(func) | ||
def wrapper(*args, **kwargs): | ||
try: | ||
return func(*args, **kwargs) | ||
except ConnectionError: | ||
return None | ||
|
||
return wrapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea. I wish we could use something like this in other parts of the app that handle Redis connection failures to reduce all those try/except blocks.
Here's a one-liner for generating the reports using the commands you shared, Dhruv, for anyone else testing: curl --silent 'http://localhost:50280/v1/audio/?page_size=3' | jq -r '.results[].id' | xargs -I{} curl \
-X POST \
-H 'content-type: application/json' \
-H 'accept: application/json, */*;q=0.5' \
-d '{"reason":"mature","description":"blah blah blah"}' \
http://localhost:50280/v1/audio/\{\}/report/ Replace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhruvkb I think we can get rid of the logic for the media report view and make it just a static view of the media report contents, if that would simplify things. Actioning reports already works from the media view, so this wouldn't affect the ability to moderate reports in prod even though the rest of these moderation workflow features aren't fully finished.
Otherwise, this LGTM, none of my comments are blocking.
@dhruvkb deferring those two further changes sounds good to me, can you create issues for them so they are tracked? |
Co-authored-by: sarayourfriend <[email protected]>
Co-authored-by: sarayourfriend <[email protected]>
@dhruvkb I caused some nasty merge conflicts for you, sorry! I've got a rebased version of this branch I'll push up in a moment once I have it fully back to the working condition of this branch for you to use and not need to do the rebase yourself. |
The branch |
@sarayourfriend thank you very much for resolving the conflicts! I compared the diffs and apart from some reorganisation, the changes lined up. So I updated this branch with your code. |
@dhruvkb I'll be reviewing this in the next 24hrs, apologies for the delay! I was so excited by this PR and following its progress that I actually failed to observe that I was one of the assigned reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent Dhruv, thanks for your hard work on this! I've tested out a lot of the flows and added a few comments that should be addressed but don't block a merge.
I did try out viewing two media items with different accounts, and then closing one of the tabs. I wasn't able to see the message disappear from the other tab, even after waiting 10 seconds. I did see this error in the console when loading the image change pages:
Uncaught TypeError: document.getElementById(...) is null
Actions http://localhost:50280/static/admin/js/actions.js:105
<anonymous> http://localhost:50280/static/admin/js/actions.js:198
actions.js:105:18
Actions http://localhost:50280/static/admin/js/actions.js:105
<anonymous> http://localhost:50280/static/admin/js/actions.js:198
Not sure if that's related. Regardless, that can be fixed in a fast-follow IMO (or part of this PR, either way).
# Start of block lifted from Django source. | ||
from django.urls import path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not have this import hoisted to the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason is because that is how it was in the Django source file I copied from. I can hoist it, it would not change the behaviour at all.
Co-authored-by: Madison Swain-Bowden <[email protected]>
Co-authored-by: Madison Swain-Bowden <[email protected]>
Fixes
Fixes #3638 by @sarayourfriend
Fixes #3639 by @sarayourfriend
Description
This PR
This PR also
Please note that this PR is intentionally allowed to deviate from some permissions and access controls. These permissions will be tightened in #3640.
Testing Instructions
For the steps involving the Django admin, it is best to use two different profiles (or even browsers) so that you can see the admin from the perspective of a superuser ("deploy") and a moderator ("moderator").
Preparing the data
Take down services (with volumes), bring up the API and initialise.
Get a few image and audio identifiers.
File many different reports of many different reasons against these identifiers. You can use this cURL command as a reference.
Testing
Access control
/admin
.Soft-locking
Additional info
Moderation actions
/moderate
endpoint which redirects back to/change
endpoint).Production deferred
/admin/api/imagereport/add/
. You should see an autocomplete field for "Media obj"./admin/api/audiodecision/add/
. You should see an inline tabular admin with autocomplete field for "Media obj".ENVIRONMENT
to "production". These fields should be replaced withraw_id_fields
that should offer considerably better performance.Report admin pages (list, create, change)
Decision admin pages (list, create, change)
request.user
automatically.Checklist
Update index.md
).main
) or a parent feature branch.just catalog/generate-docs
for catalogPRs) or the media properties generator (
just catalog/generate-docs media-props
for the catalog or
just api/generate-docs
for the API) where applicable.Developer Certificate of Origin
Developer Certificate of Origin