diff options
Diffstat (limited to 'app/models/account_warning.rb')
-rw-r--r-- | app/models/account_warning.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/app/models/account_warning.rb b/app/models/account_warning.rb index 961a078b9..4f8cc5320 100644 --- a/app/models/account_warning.rb +++ b/app/models/account_warning.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # == Schema Information # # Table name: account_warnings @@ -17,15 +18,17 @@ class AccountWarning < ApplicationRecord enum action: { - none: 0, - disable: 1_000, + none: 0, + disable: 1_000, mark_statuses_as_sensitive: 1_250, - delete_statuses: 1_500, - sensitive: 2_000, - silence: 3_000, - suspend: 4_000, + delete_statuses: 1_500, + sensitive: 2_000, + silence: 3_000, + suspend: 4_000, }, _suffix: :action + before_validation :before_validate + belongs_to :account, inverse_of: :account_warnings belongs_to :target_account, class_name: 'Account', inverse_of: :strikes belongs_to :report, optional: true @@ -47,4 +50,10 @@ class AccountWarning < ApplicationRecord def to_log_human_identifier target_account.acct end + + private + + def before_validate + self.text = '' if text.blank? + end end |