diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-11-18 03:49:02 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-11-18 03:49:02 -0600 |
commit | a44eb4a79d6cf35accd23dc6cfeb63fbd5670e13 (patch) | |
tree | b821389f3c95a659e8b35b414f9112358bbf51fa | |
parent | 953e00bc058abc58ebc2f1f7cfa6cd7679b87cba (diff) |
Use custom `f_normalize` function for transforming regex filters.
-rw-r--r-- | app/helpers/filter_helper.rb | 2 | ||||
-rw-r--r-- | app/models/status.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/helpers/filter_helper.rb b/app/helpers/filter_helper.rb index b2f1b00fc..e5144b981 100644 --- a/app/helpers/filter_helper.rb +++ b/app/helpers/filter_helper.rb @@ -7,7 +7,7 @@ module FilterHelper status = status.reblog if status.reblog? - if Status.where(id: status.id).where("statuses.normalized_text ~ ANY(ARRAY(SELECT unaccent(lower(phrase)) FROM custom_filters WHERE account_id = ?))", receiver_id).exists? + if Status.where(id: status.id).where("statuses.normalized_text ~ ANY(ARRAY(SELECT f_normalize(phrase) FROM custom_filters WHERE account_id = ?))", receiver_id).exists? redis.sadd("filtered_statuses:#{receiver_id}", status.id) return true end diff --git a/app/models/status.rb b/app/models/status.rb index af0c38624..b2330c3dd 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -119,7 +119,7 @@ class Status < ApplicationRecord scope :mention_not_excluded_by_account, ->(account) { left_outer_joins(:mentions).where('mentions.account_id IS NULL OR mentions.account_id NOT IN (?)', account.excluded_from_timeline_account_ids) } scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).where('accounts.domain IS NULL OR accounts.domain NOT IN (?)', account.excluded_from_timeline_domains) } - scope :not_string_filtered_by_account, ->(account) { where("statuses.normalized_text !~ ANY(ARRAY(SELECT unaccent(lower(phrase)) FROM custom_filters WHERE account_id = ?))", account.id) } + scope :not_string_filtered_by_account, ->(account) { where("statuses.normalized_text !~ ANY(ARRAY(SELECT f_normalize(phrase) FROM custom_filters WHERE account_id = ?))", account.id) } scope :not_missing_media_desc, -> { left_outer_joins(:media_attachments).where('media_attachments.id IS NULL OR media_attachments.description IS NOT NULL') } scope :tagged_with_all, ->(tags) { |