about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-07-13 01:47:23 +0200
committerGitHub <noreply@github.com>2017-07-13 01:47:23 +0200
commite48d3bfd01c4bdeb36d39bbdf13b6873e3444179 (patch)
tree54c6f406d773ef1abe6b4665a476b6b70bb6860b /app/models
parent5abb3d815025675d1493da4f8c6e4dda4a6672e9 (diff)
Fix #1010 - When spoiler text is set, enforce sensitivity too (#4176)
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 791d96df1..edf805336 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -124,6 +124,7 @@ class Status < ApplicationRecord
   before_validation :set_reblog
   before_validation :set_visibility
   before_validation :set_conversation
+  before_validation :set_sensitivity
 
   class << self
     def not_in_filtered_languages(account)
@@ -250,6 +251,10 @@ class Status < ApplicationRecord
     self.visibility = (account.locked? ? :private : :public) if visibility.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