about summary refs log tree commit diff
path: root/app/models/account_warning.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-01-21 21:28:13 +0100
committerGitHub <noreply@github.com>2023-01-21 21:28:13 +0100
commit368d6fe54f94ad2ecd2a1c1e7e5a2359dc37ad30 (patch)
tree716c7c9a4e7f5717e982de3c67a462aa75d3aae4 /app/models/account_warning.rb
parentc4a5e0ca0e89b2f8abd69ed9b8a4da3f82d0ccaf (diff)
parent3c76f1f6c2a95e80a02419b83478b89714a9d430 (diff)
Merge pull request #2092 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/account_warning.rb')
-rw-r--r--app/models/account_warning.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/account_warning.rb b/app/models/account_warning.rb
index 961a078b9..a181cd18d 100644
--- a/app/models/account_warning.rb
+++ b/app/models/account_warning.rb
@@ -26,6 +26,8 @@ class AccountWarning < ApplicationRecord
     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 +49,10 @@ class AccountWarning < ApplicationRecord
   def to_log_human_identifier
     target_account.acct
   end
+
+  private
+
+  def before_validate
+    self.text = '' if text.blank?
+  end
 end