diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-07-10 03:01:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 03:01:50 +0200 |
commit | 20fefdb7145b48449e9d6a824a9846dadfd6ac2f (patch) | |
tree | 114ba9b6e63246aa700544a0e211d3ed30d2c572 /app/lib | |
parent | 1ca4e51eb38de6de81cedf3ddcdaa626f1d1c569 (diff) |
Make whole-word filter regex consistent between Ruby and JS (#7987)
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/feed_manager.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index c247ab21d..14cba70dc 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -200,10 +200,11 @@ class FeedManager active_filters = Rails.cache.fetch("filters:#{receiver_id}") { CustomFilter.where(account_id: receiver_id).active_irreversible.to_a }.to_a active_filters.select! { |filter| filter.context.include?(context.to_s) && !filter.expired? } + active_filters.map! do |filter| if filter.whole_word sb = filter.phrase =~ /\A[[:word:]]/ ? '\b' : '' - eb = filter.phrase =~ /[[:word:]]\Z/ ? '\b' : '' + eb = filter.phrase =~ /[[:word:]]\z/ ? '\b' : '' /(?mix:#{sb}#{Regexp.escape(filter.phrase)}#{eb})/ else |