DEV: Add "delete user" options to illegal flag review (#29956)

We already add the "delete user" and "delete and block user" options to the drop-down for potential spam, but we should do this for potentially illegal posts as well.

This is entirely based on the implementation for the potential spam one, including caching the status on the reviewable record.

Also note that just as for potential spam, the user must be "deletable" for the option to appear.

I also took the liberty to move the options in the drop-down to what I think is a more intuitive place. (Between delete post and suspend/silence user.)
This commit is contained in:
Ted Johansson
2024-11-27 17:23:57 +08:00
committed by GitHub
parent ea2a0f2c8e
commit f4d0a77d5f
8 changed files with 58 additions and 6 deletions

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
#
class AddPotentiallyIllegalToReviewables < ActiveRecord::Migration[7.1]
def change
add_column :reviewables, :potentially_illegal, :boolean
up_only do
# NOTE: Only for records created after this migration. Trying to
# apply this as part of adding the column will attempt to backfill
# `false` into all existing reviewables. This is dangerous (locks
# a potentially huge table) and will create some false negatives.
#
change_column_default :reviewables, :potentially_illegal, false
end
end
end