diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-08-02 03:01:08 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-08-02 03:01:08 -0500 |
commit | e11196775fa4a960283ce21024a274bb4e5d26f6 (patch) | |
tree | 89393a659c3da8f4058b9f248ea677c0c8d1c92f | |
parent | 7cfc0f0dced56dd2d425ffe7151f5aa5dc0d79eb (diff) |
make sure the thread filter option won't affect your own threads or those you're participating in
-rw-r--r-- | app/helpers/filter_helper.rb | 1 | ||||
-rw-r--r-- | app/services/post_status_service.rb | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/app/helpers/filter_helper.rb b/app/helpers/filter_helper.rb index 861f37551..3120f5033 100644 --- a/app/helpers/filter_helper.rb +++ b/app/helpers/filter_helper.rb @@ -42,6 +42,7 @@ module FilterHelper end def filter_thread(account_id, conversation_id) + return if Status.where(account_id: account_id, conversation_id: conversation_id).exists? Redis.cache.sadd("filtered_threads:#{account_id}", conversation_id) end diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index cc42289d8..7106110a8 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -107,6 +107,11 @@ class PostStatusService < BaseService VISIBILITY_RANK[@visibility] < VISIBILITY_RANK[@in_reply_to.visibility] end + def unfilter_thread_on_reply + return if @in_reply_to.nil? + Redis.cache.srem("filtered_threads:#{@account.id}", @in_reply_to.conversation_id) + end + def set_local_only @local_only = true if @account.user_always_local_only? || @in_reply_to&.local_only end @@ -136,6 +141,7 @@ class PostStatusService < BaseService set_initial_visibility limit_visibility_if_silenced limit_visibility_to_reply + unfilter_thread_on_reply @sensitive = (@account.user_defaults_to_sensitive? || @options[:spoiler_text].present?) if @sensitive.nil? |