New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update filter chaining to be more consistent #27

merged 8 commits into from Oct 21, 2018


None yet
1 participant

antifuchs commented Oct 14, 2018

This PR contains some long-overdue work on filter chaining to make it more consistent & able to handle more criteria:

  • Negative and positive filter chaining now both use the same set of criteria (all of the one supported by gmail-britta).

  • Upconvert implicitly-arrayed criteria when chaining filters: This fixes #11 (looong overdue on its own)

  • Adds a bunch of tests around chaining.

antifuchs added some commits Oct 14, 2018

Include ourselves in the Gemfile
This makes it easier to run tests, so pretty clearly worth it.
Define criteria in filters differently
This will allow us to merge them in a far nicer way down the line - by
checking #criteria, instead of ad-hoc pulling only the ones that I
remembered at the time.

Also, restructure the docs a bit so that criteria come first, followed
by actions.
Default subject criteria to the empty array
...much like we did with all the other criteria that can hold arrays.
Refactor filter chaining to merge all criteria
With this change, it should be possible to fully support chained
filters that exercise any of the possible criteria gmail

There's a tiny fix in here (Fixes #11), which makes the chain merge
code automatically upconvert literals into arrays when they're not
arrays yet.
Correctly handle boolean criteria (i.e. has_attachment)
Only emit the criteria if it was set in the filter body, and if set to
false, *do* emit it.

@antifuchs antifuchs merged commit 2a2d1e8 into master Oct 21, 2018

5 checks passed

codeclimate 1 fixed issue
codeclimate/diff-coverage 93% (50% threshold)
codeclimate/total-coverage 93% (4.1% change)
continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@antifuchs antifuchs deleted the refactor-chaining branch Oct 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment