forked from cybrespace/mastodon
Record deleted(by mod) status to prevent re-appear (#10732)
* Record deleted(by mod) status to prevent re-appear * Move to Tombstone * Add missing migration script
This commit is contained in:
parent
09eea46631
commit
ce8635605c
|
@ -35,6 +35,7 @@ class Form::StatusBatch
|
||||||
def delete_statuses
|
def delete_statuses
|
||||||
Status.where(id: status_ids).reorder(nil).find_each do |status|
|
Status.where(id: status_ids).reorder(nil).find_each do |status|
|
||||||
RemovalWorker.perform_async(status.id)
|
RemovalWorker.perform_async(status.id)
|
||||||
|
Tombstone.find_or_create_by(uri: status.uri, account: status.account, by_moderator: true)
|
||||||
log_action :destroy, status
|
log_action :destroy, status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
# uri :string not null
|
# uri :string not null
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
|
# by_moderator :boolean
|
||||||
#
|
#
|
||||||
|
|
||||||
class Tombstone < ApplicationRecord
|
class Tombstone < ApplicationRecord
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddByModeratorToTombstone < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :tombstones, :by_moderator, :boolean
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2019_04_20_025523) do
|
ActiveRecord::Schema.define(version: 2019_05_09_164208) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -382,9 +382,9 @@ ActiveRecord::Schema.define(version: 2019_04_20_025523) do
|
||||||
create_table "mutes", force: :cascade do |t|
|
create_table "mutes", force: :cascade do |t|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.boolean "hide_notifications", default: true, null: false
|
||||||
t.bigint "account_id", null: false
|
t.bigint "account_id", null: false
|
||||||
t.bigint "target_account_id", null: false
|
t.bigint "target_account_id", null: false
|
||||||
t.boolean "hide_notifications", default: true, null: false
|
|
||||||
t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true
|
t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true
|
||||||
t.index ["target_account_id"], name: "index_mutes_on_target_account_id"
|
t.index ["target_account_id"], name: "index_mutes_on_target_account_id"
|
||||||
end
|
end
|
||||||
|
@ -676,6 +676,7 @@ ActiveRecord::Schema.define(version: 2019_04_20_025523) do
|
||||||
t.string "uri", null: false
|
t.string "uri", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.boolean "by_moderator"
|
||||||
t.index ["account_id"], name: "index_tombstones_on_account_id"
|
t.index ["account_id"], name: "index_tombstones_on_account_id"
|
||||||
t.index ["uri"], name: "index_tombstones_on_uri"
|
t.index ["uri"], name: "index_tombstones_on_uri"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue