about summary refs log tree commit diff
path: root/spec/models/glitch
AgeCommit message (Collapse)Author
2018-04-30Also treat non-whole-word mutes as case-insensitive. #450.David Yip
2018-02-10Use Html2Text to generate plaintext for keyword mutes. #236.David Yip
This allows us to match URLs inside link hrefs.
2018-02-10Glitch::FilterHelper -> Glitch::KeywordMuteHelper. #234.David Yip
The class helps out with keyword mutes, not just some general concept of "filtering".
2018-02-10Fill out some examples for Glitch::FilterHelper. #234.David Yip
Also add HTML entity decoding to Glitch::FilterHelper, which is needed to e.g. match "<" to the tag-stripped version of "<p><3</p>" or "<p>&lt;3</p>".
2017-11-15Add some examples for Glitch::KeywordMute::TagMatcher. #208.David Yip
2017-11-15Replace =~ with #matches?. #208.David Yip
=~ 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.
2017-11-15Match keyword mute filter on hashtags. #208.David Yip
It is reasonable to expect someone to enter #foo to mute hashtag #foo. However, tags are recorded on statuses without the preceding #. To adjust for this, we build a separate tag matcher and use Tag::HASHTAG_RE to extract a hashtag from the hashtag syntax.
2017-11-13Maintain case-insensitivity when merging multiple matchers (#213)David Yip
When given two regexps, Regexp.union preserves the options set (or not set) on each regex; this meant that none of the multiline (m), case-insensitivity (i), or extended syntax (x) options were set. Our regexps are written expecting the m, i, and x options were set on all of them, so we need to make sure that we preserve that behavior.
2017-10-24Fix example description.David Yip
This example actually checks matches at the end of a string.
2017-10-22Don't add \b to whole-word keywords that don't start with word characters.David Yip
Ditto for ending with \b. Consider muting the phrase "(hot take)". I stipulate it is reasonable to enter this with the default "match whole word" behavior. Under the old behavior, this would be encoded as \b\(hot\ take\)\b However, if \b is before the first character in the string and the first character in the string is not a word character, then the match will fail. Ditto for after. In our example, "(" is not a word character, so this will not match statuses containing "(hot take)", and that's a very surprising behavior. To address this, we only add leading and trailing \b to keywords that start or end with word characters.
2017-10-21Move KeywordMute into Glitch namespace.David Yip
There are two motivations for this: 1. It looks like we're going to add other features that require server-side storage (e.g. user notes). 2. Namespacing glitchsoc modifications is a good idea anyway: even if we do not end up doing (1), if upstream introduces a keyword-mute feature that also uses a "KeywordMute" model, we can avoid some merge conflicts this way and work on the more interesting task of choosing which implementation to use.