Fix auto-added media icons when a CW is set but no content text

lolsob-rspec
Thibaut Girka 2019-08-31 13:09:21 +02:00
parent 90ac926b1c
commit c6591e1283
1 changed files with 7 additions and 1 deletions

View File

@ -49,7 +49,13 @@ class PostStatusService < BaseService
def preprocess_attributes! def preprocess_attributes!
if @text.blank? && @options[:spoiler_text].present? if @text.blank? && @options[:spoiler_text].present?
@text = '.' @text = '.'
@text = @media.find(&:video?) ? '📹' : '🖼' if @media.size > 0 if @media.find(&:video?) || @media.find(&:gifv?)
@text = '📹'
elsif @media.find(&:audio?)
@text = '🎵'
elsif @media.find(&:image?)
@text = '🖼'
end
end end
@visibility = @options[:visibility] || @account.user&.setting_default_privacy @visibility = @options[:visibility] || @account.user&.setting_default_privacy
@visibility = :unlisted if @visibility == :public && @account.silenced? @visibility = :unlisted if @visibility == :public && @account.silenced?