]> cat aescling's git repositories - mastodon.git/commitdiff
KeywordMute matcher: more closely mimic Regexp#=~ behavior.
authorDavid Yip <yipdw@member.fsf.org>
Sun, 22 Oct 2017 06:11:17 +0000 (01:11 -0500)
committerDavid Yip <yipdw@member.fsf.org>
Sun, 22 Oct 2017 06:12:21 +0000 (01:12 -0500)
Regexp#=~ returns nil if it does not match.  An empty mute set does not
match any status, so KeywordMute::Matcher#=~ ought to return nil also.

app/models/glitch/keyword_mute.rb

index 20fd89d9be6706e50f9f4135c978061501239587..a7ab3650ea71531dfe8553608361f05aad9b12b5 100644 (file)
@@ -61,7 +61,7 @@ class Glitch::KeywordMute < ApplicationRecord
     end
 
     def =~(str)
-      regex ? regex =~ str : false
+      regex ? regex =~ str : nil
     end
   end
 end
This page took 0.024022 seconds and 3 git commands to generate.