mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 09:08:24 +00:00
Fix Account Strike causing PG not null validation error (#23178)
This commit is contained in:
parent
8180f7ba19
commit
a1abda39dd
|
@ -26,6 +26,8 @@ class AccountWarning < ApplicationRecord
|
||||||
suspend: 4_000,
|
suspend: 4_000,
|
||||||
}, _suffix: :action
|
}, _suffix: :action
|
||||||
|
|
||||||
|
before_validation :before_validate
|
||||||
|
|
||||||
belongs_to :account, inverse_of: :account_warnings
|
belongs_to :account, inverse_of: :account_warnings
|
||||||
belongs_to :target_account, class_name: 'Account', inverse_of: :strikes
|
belongs_to :target_account, class_name: 'Account', inverse_of: :strikes
|
||||||
belongs_to :report, optional: true
|
belongs_to :report, optional: true
|
||||||
|
@ -47,4 +49,10 @@ class AccountWarning < ApplicationRecord
|
||||||
def to_log_human_identifier
|
def to_log_human_identifier
|
||||||
target_account.acct
|
target_account.acct
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def before_validate
|
||||||
|
self.text = '' if text.blank?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue