|
|
@ -23,13 +23,16 @@ class PostStatusService < BaseService |
|
|
|
status = nil |
|
|
|
status = nil |
|
|
|
text = options.delete(:spoiler_text) if text.blank? && 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 == :public && account.silenced |
|
|
|
|
|
|
|
|
|
|
|
ApplicationRecord.transaction do |
|
|
|
ApplicationRecord.transaction do |
|
|
|
status = account.statuses.create!(text: text, |
|
|
|
status = account.statuses.create!(text: text, |
|
|
|
media_attachments: media || [], |
|
|
|
media_attachments: media || [], |
|
|
|
thread: in_reply_to, |
|
|
|
thread: in_reply_to, |
|
|
|
sensitive: (options[:sensitive].nil? ? account.user&.setting_default_sensitive : options[:sensitive]) || options[:spoiler_text].present?, |
|
|
|
sensitive: (options[:sensitive].nil? ? account.user&.setting_default_sensitive : options[:sensitive]) || options[:spoiler_text].present?, |
|
|
|
spoiler_text: options[:spoiler_text] || '', |
|
|
|
spoiler_text: options[:spoiler_text] || '', |
|
|
|
visibility: options[:visibility] || account.user&.setting_default_privacy, |
|
|
|
visibility: visibility, |
|
|
|
language: language_from_option(options[:language]) || account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(text, account), |
|
|
|
language: language_from_option(options[:language]) || account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(text, account), |
|
|
|
application: options[:application]) |
|
|
|
application: options[:application]) |
|
|
|
end |
|
|
|
end |
|
|
|