diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/filter_helper.rb | 11 | ||||
-rw-r--r-- | app/serializers/rest/status_serializer.rb | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/helpers/filter_helper.rb b/app/helpers/filter_helper.rb index 66ac5014d..b2b78bc44 100644 --- a/app/helpers/filter_helper.rb +++ b/app/helpers/filter_helper.rb @@ -3,7 +3,7 @@ module FilterHelper def phrase_filtered?(status, receiver_id, context) if redis.sismember("filtered_statuses:#{receiver_id}", status.id) - return redis.hexists("custom_cw:#{receiver_id}", status.id) + return !(redis.hexists("custom_cw:#{receiver_id}", status.id) || redis.hexists("custom_cw:#{receiver_id}", "c#{status.conversation_id}")) end filters = cached_filters(receiver_id) @@ -38,7 +38,7 @@ module FilterHelper matched = true unless tags.empty? || regex.match(tags).nil? if matched - filter_thread(receiver_id, status.conversation_id) if filter.thread + filter_thread(receiver_id, status.conversation_id) if filter.thread && filter.custom_cw.blank? unless filter.custom_cw.blank? cw = if filter.override_cw || status.spoiler_text.blank? @@ -46,7 +46,12 @@ module FilterHelper else "[#{filter.custom_cw}] #{status.spoiler_text}".rstrip end - redis.hset("custom_cw:#{receiver_id}", status.id, cw) + + if filter.thread + redis.hset("custom_cw:#{receiver_id}", "c#{status.conversation_id}", cw) + else + redis.hset("custom_cw:#{receiver_id}", status.id, cw) + end end redis.sadd("filtered_statuses:#{receiver_id}", status.id) diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index d41d1ba43..86c63e772 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -58,7 +58,7 @@ class REST::StatusSerializer < ActiveModel::Serializer end def spoiler_text - redis.hget("custom_cw:#{current_user&.account_id}", object.id) || object.spoiler_text + redis.hget("custom_cw:#{current_user&.account_id}", object.id) || redis.hget("custom_cw:#{current_user&.account_id}", "c#{object.conversation_id}") || object.spoiler_text end def visibility |