Remove text requirement when media attached from statuses (#6672)
This commit is contained in:
parent
e26d5ca923
commit
cfa9b6e13a
8 changed files with 28 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue