diff options
author | ThibG <thib@sitedethib.com> | 2020-03-28 15:19:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 15:19:05 +0100 |
commit | a192b193bdf7013df09c6cd63916274cd9d47cf7 (patch) | |
tree | 413de2a72a6f3a126e19e12178524ca33c27e436 /app/services/post_status_service.rb | |
parent | 02f1c04fabab221130de8dfb5611be81825b193b (diff) | |
parent | d98fabf2ee44c2c25775066abda46552ab05993e (diff) |
Merge pull request #1308 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/services/post_status_service.rb')
-rw-r--r-- | app/services/post_status_service.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 5b181b193..250d0e8ed 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -50,14 +50,15 @@ class PostStatusService < BaseService def preprocess_attributes! if @text.blank? && @options[:spoiler_text].present? @text = '.' - if @media.find(&:video?) || @media.find(&:gifv?) + if @media&.find(&:video?) || @media&.find(&:gifv?) @text = '📹' - elsif @media.find(&:audio?) + elsif @media&.find(&:audio?) @text = '🎵' - elsif @media.find(&:image?) + elsif @media&.find(&:image?) @text = '🖼' end end + @sensitive = (@options[:sensitive].nil? ? @account.user&.setting_default_sensitive : @options[:sensitive]) || @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 @@ -166,7 +167,7 @@ class PostStatusService < BaseService media_attachments: @media || [], thread: @in_reply_to, poll_attributes: poll_attributes, - sensitive: (@options[:sensitive].nil? ? @account.user&.setting_default_sensitive : @options[:sensitive]) || @options[:spoiler_text].present?, + sensitive: @sensitive, spoiler_text: @options[:spoiler_text] || '', visibility: @visibility, language: language_from_option(@options[:language]) || @account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(@text, @account), |