logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: e48d3bfd01c4bdeb36d39bbdf13b6873e3444179
parent: 5abb3d815025675d1493da4f8c6e4dda4a6672e9
Author: Eugen Rochko <eugen@zeonfederated.com>
Date:   Thu, 13 Jul 2017 01:47:23 +0200

Fix #1010 - When spoiler text is set, enforce sensitivity too (#4176)


Diffstat:

Mapp/models/status.rb5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git 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