From e48d3bfd01c4bdeb36d39bbdf13b6873e3444179 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 13 Jul 2017 01:47:23 +0200 Subject: [PATCH] Fix #1010 - When spoiler text is set, enforce sensitivity too (#4176) --- app/models/status.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/status.rb b/app/models/status.rb index 791d96df1a..edf8053363 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