diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-05-10 03:48:11 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:23 -0500 |
commit | 3b06175e8f5cb9d688e8ec376dbfd88abf5f3278 (patch) | |
tree | 160a6f6c97777ca022326bb93701f358fe689c99 /db | |
parent | 5c59d1837f2d3152342ef45bf7827495183e62dd (diff) |
Moderation: add `force sensitive` and `force unlisted` actions. Accounts: add federatable `adult content` tag. Handle from remote accounts as well.
Diffstat (limited to 'db')
7 files changed, 78 insertions, 0 deletions
diff --git a/db/migrate/20190509183411_add_force_sensitive_to_domain_blocks.rb b/db/migrate/20190509183411_add_force_sensitive_to_domain_blocks.rb new file mode 100644 index 000000000..c27fb0385 --- /dev/null +++ b/db/migrate/20190509183411_add_force_sensitive_to_domain_blocks.rb @@ -0,0 +1,16 @@ +require Rails.root.join('lib', 'mastodon', 'migration_helpers') +class AddForceSensitiveToDomainBlocks < ActiveRecord::Migration[5.2] + include Mastodon::MigrationHelpers + + disable_ddl_transaction! + + def up + safety_assured do + add_column_with_default :domain_blocks, :force_sensitive, :boolean, default: false, allow_null: false + end + end + + def down + remove_column :domain_blocks, :force_sensitive + end +end diff --git a/db/migrate/20190509185038_add_network_index_to_statuses.rb b/db/migrate/20190509185038_add_network_index_to_statuses.rb new file mode 100644 index 000000000..761cebfc8 --- /dev/null +++ b/db/migrate/20190509185038_add_network_index_to_statuses.rb @@ -0,0 +1,6 @@ +class AddNetworkIndexToStatuses < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + def change + add_index :statuses, :network, where: :network, algorithm: :concurrently + end +end diff --git a/db/migrate/20190509190505_update_domain_block_severity_enum.rb b/db/migrate/20190509190505_update_domain_block_severity_enum.rb new file mode 100644 index 000000000..90fbb7ebf --- /dev/null +++ b/db/migrate/20190509190505_update_domain_block_severity_enum.rb @@ -0,0 +1,19 @@ +class UpdateDomainBlockSeverityEnum < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + DomainBlock.where(severity: :force_unlisted).each do |block| + block.severity = :suspend + block.save + end + + DomainBlock.where(severity: :noop).each do |block| + block.severity = :silence + block.save + end + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/migrate/20190509201242_add_force_options_to_accounts.rb b/db/migrate/20190509201242_add_force_options_to_accounts.rb new file mode 100644 index 000000000..709efafaf --- /dev/null +++ b/db/migrate/20190509201242_add_force_options_to_accounts.rb @@ -0,0 +1,8 @@ +class AddForceOptionsToAccounts < ActiveRecord::Migration[5.2] + def change + safety_assured { + add_column :accounts, :force_unlisted, :boolean, null: false, default: false + add_column :accounts, :force_sensitive, :boolean, null: false, default: false + } + end +end diff --git a/db/migrate/20190509201451_add_adults_only_to_accounts.rb b/db/migrate/20190509201451_add_adults_only_to_accounts.rb new file mode 100644 index 000000000..179d28ef4 --- /dev/null +++ b/db/migrate/20190509201451_add_adults_only_to_accounts.rb @@ -0,0 +1,5 @@ +class AddAdultsOnlyToAccounts < ActiveRecord::Migration[5.2] + def change + safety_assured { add_column :accounts, :adults_only, :boolean, null: false, default: false } + end +end diff --git a/db/migrate/20190510071027_update_account_warning_action_enum.rb b/db/migrate/20190510071027_update_account_warning_action_enum.rb new file mode 100644 index 000000000..b89fb60d2 --- /dev/null +++ b/db/migrate/20190510071027_update_account_warning_action_enum.rb @@ -0,0 +1,19 @@ +class UpdateAccountWarningActionEnum < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + AccountWarning.where(action: :force_unlisted).each do |warning| + warning.severity = :suspend + warning.save + end + + AccountWarning.where(action: :force_sensitive).each do |warning| + warning.severity = :silence + warning.save + end + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/schema.rb b/db/schema.rb index 3f0d3ce80..19725e8a1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -151,6 +151,9 @@ ActiveRecord::Schema.define(version: 2019_05_19_130537) do t.jsonb "vars", default: {}, null: false t.boolean "replies", default: true, null: false t.boolean "unlisted", default: false, null: false + t.boolean "force_unlisted", default: false, null: false + t.boolean "force_sensitive", default: false, null: false + t.boolean "adults_only", default: false, null: false t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id" @@ -258,6 +261,7 @@ ActiveRecord::Schema.define(version: 2019_05_19_130537) do t.integer "severity", default: 0 t.boolean "reject_media", default: false, null: false t.boolean "reject_reports", default: false, null: false + t.boolean "force_sensitive", default: false, null: false t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true end @@ -651,6 +655,7 @@ ActiveRecord::Schema.define(version: 2019_05_19_130537) do t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20180106", order: { id: :desc } t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id" t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id" + t.index ["network"], name: "index_statuses_on_network", where: "network" t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id" t.index ["tsv"], name: "tsv_idx", using: :gin t.index ["uri"], name: "index_statuses_on_uri", unique: true |