Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 20:02:09 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: account_warnings
|
|
|
|
#
|
|
|
|
# id :bigint(8) not null, primary key
|
|
|
|
# account_id :bigint(8)
|
|
|
|
# target_account_id :bigint(8)
|
|
|
|
# action :integer default("none"), not null
|
|
|
|
# text :text default(""), not null
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
#
|
|
|
|
|
|
|
|
class AccountWarning < ApplicationRecord
|
2020-11-04 20:45:01 +01:00
|
|
|
enum action: %i(none disable sensitive silence suspend), _suffix: :action
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 20:02:09 +01:00
|
|
|
|
|
|
|
belongs_to :account, inverse_of: :account_warnings
|
|
|
|
belongs_to :target_account, class_name: 'Account', inverse_of: :targeted_account_warnings
|
|
|
|
|
|
|
|
scope :latest, -> { order(created_at: :desc) }
|
|
|
|
scope :custom, -> { where.not(text: '') }
|
|
|
|
end
|