about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-25 00:49:08 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-25 01:29:16 +0100
commit999cde94a6a2d67cf36160365378951d3b55b868 (patch)
tree51d86739522f79ee545f7c821507997f0a4914cb /app/models/status.rb
parentf8da0dd4907490f57cb14b052b767c66c95c4db3 (diff)
Instead of using spoiler boolean and spoiler_text, simply check for non-blank spoiler_text
Federate spoiler_text using warning attribute on <content /> instead of a <category term="spoiler" />
Clean up schema file from accidental development migrations
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 42abe92e5..651d0dbc9 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -28,9 +28,8 @@ class Status < ApplicationRecord
 
   validates :account, presence: true
   validates :uri, uniqueness: true, unless: 'local?'
-  validates :text, presence: true, if: proc { |s| s.local? && !s.reblog? }
+  validates :text, presence: true, unless: 'reblog?'
   validates_with StatusLengthValidator
-  validates :text, presence: true, if: proc { |s| !s.local? && !s.reblog? }
   validates :reblog, uniqueness: { scope: :account, message: 'of status already exists' }, if: 'reblog?'
 
   default_scope { order('id desc') }
@@ -176,6 +175,7 @@ class Status < ApplicationRecord
 
   before_validation do
     text.strip!
+    spoiler_text&.strip!
 
     self.reblog                 = reblog.reblog if reblog? && reblog.reblog?
     self.in_reply_to_account_id = (thread.account_id == account_id && thread.reply? ? thread.in_reply_to_account_id : thread.account_id) if reply?