Skip to content

Commit

Permalink
Do not mark remote status sensitive even if spoiler text is present (#…
Browse files Browse the repository at this point in the history
…7395)

Old statuses and statuses from Pawoo, which runs a modified version of
Mastodon, may not have been marked sensitive even if spoiler text is
present.

Such statuses are still not marked sensitve if they are local or
arrived before version upgrade. Marking recently fetched remote status
sensitive contradicts the behavior.

Considering what people expected when they authored such statuses, this
change removes the sensitivity enforcement.
  • Loading branch information
akihikodaki authored and Gargron committed Jun 4, 2018
1 parent 73923ea commit 5bf5003
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions app/models/status.rb
Expand Up @@ -187,7 +187,6 @@ def marked_for_mass_destruction?
before_validation :set_reblog
before_validation :set_visibility
before_validation :set_conversation
before_validation :set_sensitivity
before_validation :set_local

class << self
Expand Down Expand Up @@ -368,10 +367,6 @@ def set_visibility
self.sensitive = false if sensitive.nil?
end

def set_sensitivity
self.sensitive = sensitive || spoiler_text.present?
end

def set_conversation
self.reply = !(in_reply_to_id.nil? && thread.nil?) unless reply

Expand Down
2 changes: 1 addition & 1 deletion app/services/post_status_service.rb
Expand Up @@ -28,7 +28,7 @@ def call(account, text, in_reply_to = nil, **options)
status = account.statuses.create!(text: text,
media_attachments: media || [],
thread: in_reply_to,
sensitive: (options[:sensitive].nil? ? account.user&.setting_default_sensitive : options[:sensitive]),
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,
language: language_from_option(options[:language]) || LanguageDetector.instance.detect(text, account),
Expand Down

0 comments on commit 5bf5003

Please sign in to comment.