Closed stacimc closed 1 month ago
Adding a note here that we should make sure not to rely on the existing methods for marking sensitive or deleting media, as those do not do bulk operations and are wildly inefficient if used for a bulk operation (e.g., if used in a for
loop over a set of sensitive or deleted media instances).
Description
Create the custom Django admin actions for bulk moderation decisions. All bulk actions should go through an intermediate confirmation page which:
Indicates the number of records that will be affected by the action
Collects the required
explanation
text for the ModerationDecision (all other columns, such as moderator_id and created_on, are filled in automatically)bulk deindex sensitive
deindexed_sensitive
and adds all records from the queryset. It then creates and saves DeletedMedia records for each of these, deleting the record from the API and deindexing it in Elasticsearch. The confirmation page for this action should include a highly visible warning that once records are deindexed, they cannot be restored immediately.bulk deindex copyright
deindexed_copyright
.bulk mark sensitive
marked_sensitive
. It then creates and saves SensitiveMedia records for each of the added records.bulk reverse mark sensitive
reversed_mark_sensitive
, and adds the related media. Then it first calls _update_es on the SensitiveMedia records to update the Elasticsearch index with the “sensitive” field for each media record, and finally deletes the actual SensitiveMedia records.bulk reverse deindex
reversed_deindex
and adds the related records. Then it deletes the DeletedMedia records.More details can be found in the IP here.
Actions will be added to the appropriate views in subsequent issues.
Blocks https://github.com/WordPress/openverse/issues/3841, https://github.com/WordPress/openverse/issues/3842, and https://github.com/WordPress/openverse/issues/3843