about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-03-07 08:28:52 +0100
committerGitHub <noreply@github.com>2018-03-07 08:28:52 +0100
commitcfa9b6e13ab3c434f3901df6f614d0aa94a3d1ed (patch)
treee303778680cdd80ad5a31ec5fb3b28ba5dc834ef /app/models
parente26d5ca923353c9cd61073c444c0841bae4b9664 (diff)
Remove text requirement when media attached from statuses (#6672)
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index f806a59fc..60fa7a22e 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -57,7 +57,7 @@ class Status < ApplicationRecord
   has_one :stream_entry, as: :activity, inverse_of: :status
 
   validates :uri, uniqueness: true, presence: true, unless: :local?
-  validates :text, presence: true, unless: :reblog?
+  validates :text, presence: true, unless: -> { with_media? || reblog? }
   validates_with StatusLengthValidator
   validates :reblog, uniqueness: { scope: :account }, if: :reblog?
 
@@ -150,8 +150,12 @@ class Status < ApplicationRecord
     private_visibility? || direct_visibility?
   end
 
+  def with_media?
+    media_attachments.any?
+  end
+
   def non_sensitive_with_media?
-    !sensitive? && media_attachments.any?
+    !sensitive? && with_media?
   end
 
   def emojis