about summary refs log tree commit diff
path: root/app/lib/feed_manager.rb
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2017-11-15 18:26:21 -0600
committerDavid Yip <yipdw@member.fsf.org>2017-11-15 18:27:25 -0600
commit08652baab018e65cfc4e1fbcfc909ff01f96ea60 (patch)
tree3f0f6a7521a57b40400af10bd0460177e898b0bd /app/lib/feed_manager.rb
parent8fc54890e50de024683d9b763b8ed8f82d46433a (diff)
Replace =~ with #matches?. #208.
=~ made sense when we were passing it through to a regex, but we're no
longer doing that: TagMatcher looks at individual tags and returns a
value that *looks* like what you get out of #=~ but really isn't that
meaningful.  Probably a good idea to not subvert convention like this
and instead use a name with guessable intent.
Diffstat (limited to 'app/lib/feed_manager.rb')
-rw-r--r--app/lib/feed_manager.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb
index e12a5c016..a99606e1b 100644
--- a/app/lib/feed_manager.rb
+++ b/app/lib/feed_manager.rb
@@ -174,19 +174,19 @@ class FeedManager
     text_matcher = Glitch::KeywordMute.text_matcher_for(receiver_id)
     tag_matcher  = Glitch::KeywordMute.tag_matcher_for(receiver_id)
 
-    should_filter   = text_matcher =~ status.text
-    should_filter ||= text_matcher =~ status.spoiler_text
-    should_filter ||= tag_matcher =~ status.tags
+    should_filter   = text_matcher.matches?(status.text)
+    should_filter ||= text_matcher.matches?(status.spoiler_text)
+    should_filter ||= tag_matcher.matches?(status.tags)
 
     if status.reblog?
       reblog = status.reblog
 
-      should_filter ||= text_matcher =~ reblog.text
-      should_filter ||= text_matcher =~ reblog.spoiler_text
-      should_filter ||= tag_matcher =~ status.tags
+      should_filter ||= text_matcher.matches?(reblog.text)
+      should_filter ||= text_matcher.matches?(reblog.spoiler_text)
+      should_filter ||= tag_matcher.matches?(status.tags)
     end
 
-    !!should_filter
+    should_filter
   end
 
   def filter_from_mentions?(status, receiver_id)