]> cat aescling's git repositories - mastodon.git/commitdiff
Fix auto-added media icons when a CW is set but no content text
authorThibaut Girka <thib@sitedethib.com>
Sat, 31 Aug 2019 11:09:21 +0000 (13:09 +0200)
committerThibaut Girka <thib@sitedethib.com>
Sat, 31 Aug 2019 16:23:24 +0000 (18:23 +0200)
app/services/post_status_service.rb

index b3647133940ce9a35a52696da4ba2657825d67c7..5d17f111b56c4d8bd2e0c02a1cb947afb73eec66 100644 (file)
@@ -49,7 +49,13 @@ class PostStatusService < BaseService
   def preprocess_attributes!
     if @text.blank? && @options[:spoiler_text].present?
      @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
     @visibility   = @options[:visibility] || @account.user&.setting_default_privacy
     @visibility   = :unlisted if @visibility == :public && @account.silenced?