about summary refs log tree commit diff
path: root/app/services/post_status_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/post_status_service.rb')
-rw-r--r--app/services/post_status_service.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 294ae43eb..9d26e0f5b 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -48,8 +48,17 @@ class PostStatusService < BaseService
   private
 
   def preprocess_attributes!
+    if @text.blank? && @options[:spoiler_text].present?
+     @text = '.'
+     if @media&.find(&:video?) || @media&.find(&:gifv?)
+       @text = '📹'
+     elsif @media&.find(&:audio?)
+       @text = '🎵'
+     elsif @media&.find(&:image?)
+       @text = '🖼'
+     end
+    end
     @sensitive    = (@options[:sensitive].nil? ? @account.user&.setting_default_sensitive : @options[:sensitive]) || @options[:spoiler_text].present?
-    @text         = @options.delete(:spoiler_text) if @text.blank? && @options[:spoiler_text].present?
     @visibility   = @options[:visibility] || @account.user&.setting_default_privacy
     @visibility   = :unlisted if @visibility&.to_sym == :public && @account.silenced?
     @scheduled_at = @options[:scheduled_at]&.to_datetime
@@ -94,7 +103,7 @@ class PostStatusService < BaseService
     Trends.tags.register(@status)
     LinkCrawlWorker.perform_async(@status.id)
     DistributionWorker.perform_async(@status.id)
-    ActivityPub::DistributionWorker.perform_async(@status.id)
+    ActivityPub::DistributionWorker.perform_async(@status.id) unless @status.local_only?
     PollExpirationNotifyWorker.perform_at(@status.poll.expires_at, @status.poll.id) if @status.poll
   end
 
@@ -167,6 +176,7 @@ class PostStatusService < BaseService
       visibility: @visibility,
       language: language_from_option(@options[:language]) || @account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(@text, @account),
       application: @options[:application],
+      content_type: @options[:content_type] || @account.user&.setting_default_content_type,
       rate_limit: @options[:with_rate_limit],
     }.compact
   end