diff options
author | ThibG <thib@sitedethib.com> | 2018-12-24 19:06:14 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-12-24 19:06:14 +0100 |
commit | 5f387995d9ae6f89c93518518233c6d9874f6621 (patch) | |
tree | 980b3337f217028a45b1db840b0c0d2c62dbbfaf /app | |
parent | e25947db4a44cd50fa1daa36d5031a950327b646 (diff) |
Limit maximum visibility of local silenced users to unlisted (#9583)
Fixes #9580
Diffstat (limited to 'app')
-rw-r--r-- | app/services/post_status_service.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 300eae547..d0c4fe146 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -23,13 +23,16 @@ class PostStatusService < BaseService status = nil 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 status = account.statuses.create!(text: text, media_attachments: media || [], thread: in_reply_to, sensitive: (options[:sensitive].nil? ? account.user&.setting_default_sensitive : options[:sensitive]) || options[:spoiler_text].present?, 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), application: options[:application]) end |