Add notifications for statuses deleted by moderators (#17204)

This commit is contained in:
Eugen Rochko 2022-01-17 09:41:33 +01:00 committed by GitHub
parent d5c9feb7b7
commit 14f436c457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 1220 additions and 598 deletions

View file

@ -0,0 +1,21 @@
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
class AddCategoryToReports < ActiveRecord::Migration[6.1]
include Mastodon::MigrationHelpers
disable_ddl_transaction!
def up
safety_assured { add_column_with_default :reports, :category, :int, default: 0, allow_null: false }
add_column :reports, :action_taken_at, :datetime
add_column :reports, :rule_ids, :bigint, array: true
safety_assured { execute 'UPDATE reports SET action_taken_at = updated_at WHERE action_taken = TRUE' }
end
def down
safety_assured { execute 'UPDATE reports SET action_taken = TRUE WHERE action_taken_at IS NOT NULL' }
remove_column :reports, :category
remove_column :reports, :action_taken_at
remove_column :reports, :rule_ids
end
end

View file

@ -0,0 +1,6 @@
class AddReportIdToAccountWarnings < ActiveRecord::Migration[6.1]
def change
safety_assured { add_reference :account_warnings, :report, foreign_key: { on_delete: :cascade }, index: false }
add_column :account_warnings, :status_ids, :string, array: true
end
end

View file

@ -0,0 +1,21 @@
class FixAccountWarningActions < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def up
safety_assured do
execute 'UPDATE account_warnings SET action = 1000 WHERE action = 1'
execute 'UPDATE account_warnings SET action = 2000 WHERE action = 2'
execute 'UPDATE account_warnings SET action = 3000 WHERE action = 3'
execute 'UPDATE account_warnings SET action = 4000 WHERE action = 4'
end
end
def down
safety_assured do
execute 'UPDATE account_warnings SET action = 1 WHERE action = 1000'
execute 'UPDATE account_warnings SET action = 2 WHERE action = 2000'
execute 'UPDATE account_warnings SET action = 3 WHERE action = 3000'
execute 'UPDATE account_warnings SET action = 4 WHERE action = 4000'
end
end
end

View file

@ -0,0 +1,7 @@
class AddDeletedAtIndexOnStatuses < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def change
add_index :statuses, :deleted_at, where: 'deleted_at IS NOT NULL', algorithm: :concurrently
end
end