diff options
author | David Yip <yipdw@member.fsf.org> | 2018-06-03 19:41:54 -0500 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2018-06-03 23:00:50 -0500 |
commit | 26573ad7e67e64d6db222877cf2853920c2c7dae (patch) | |
tree | 18d16514ea853d20ccb04eef858c7966690ba69c /app/models/glitch/keyword_mute_helper.rb | |
parent | 37d495eeeb810127e0c6c62bff865c1ba66f45c8 (diff) |
Thread scopes through #matches?. #454.
Also add an apply_to_mentions attribute on Glitch::KeywordMute, which is used to calculate scope. Next up: additions to the test suite to demonstrate how scoping works.
Diffstat (limited to 'app/models/glitch/keyword_mute_helper.rb')
-rw-r--r-- | app/models/glitch/keyword_mute_helper.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/glitch/keyword_mute_helper.rb b/app/models/glitch/keyword_mute_helper.rb index 6d067947f..955c3b1f3 100644 --- a/app/models/glitch/keyword_mute_helper.rb +++ b/app/models/glitch/keyword_mute_helper.rb @@ -9,16 +9,16 @@ class Glitch::KeywordMuteHelper @tag_matcher = Glitch::KeywordMute.tag_matcher_for(receiver_id) end - def matches?(status) - matchers_match?(status) || (status.reblog? && matchers_match?(status.reblog)) + def matches?(status, scope) + matchers_match?(status, scope) || (status.reblog? && matchers_match?(status.reblog, scope)) end private - def matchers_match?(status) - text_matcher.matches?(prepare_text(status.text)) || - text_matcher.matches?(prepare_text(status.spoiler_text)) || - tag_matcher.matches?(status.tags) + def matchers_match?(status, scope) + text_matcher.matches?(prepare_text(status.text), scope) || + text_matcher.matches?(prepare_text(status.spoiler_text), scope) || + tag_matcher.matches?(status.tags, scope) end def prepare_text(text) |