0
0
Fork 0

Remove text requirement when media attached from statuses (#6672)

This commit is contained in:
Eugen Rochko 2018-03-07 08:28:52 +01:00 committed by GitHub
parent e26d5ca923
commit cfa9b6e13a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 18 deletions

View file

@ -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