Support the deliveredto operator natively - #469
Merged
Merged
Conversation
Gmail's `deliveredto:` operator matches the Delivered-To header, which
makes it possible to filter on `+` aliases (me+tag@gmail.com) and on
mail coming from forwarding services such as SimpleLogin, regardless of
the recipients in To. Until now it was only reachable through `query`,
e.g.:
{ query: 'deliveredto:%s' % std.escapeStringJson(alias) }
A native `deliveredto` field, which works like `replyto` and `list`,
does better than a `query` in three ways:
- Multiple addresses are grouped into a single operator.
- Rules using it can be covered by `gmailctl test`, which rejects
`query` because it can't know what an arbitrary query matches.
- Values are quoted by the same logic as all the other operators,
instead of relying on JSON escaping.
Gmail's filter UI has no field for `deliveredto`, but the same is true
for cc, bcc, replyto and list, which are already supported natively
for the same reasons.
The new function is placed right after replyto, which doesn't change
the relative order of the existing functions, so the generated queries
for existing configs stay the same.
Close #377.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (69.23%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #469 +/- ##
==========================================
+ Coverage 41.86% 41.94% +0.08%
==========================================
Files 54 54
Lines 3698 3710 +12
==========================================
+ Hits 1548 1556 +8
- Misses 2049 2053 +4
Partials 101 101 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gmail's
deliveredto:operator matches the Delivered-To header, which makes it possible to filter on+aliases (me+tag@gmail.com) and on mail coming from forwarding services such as SimpleLogin, regardless of the recipients in To. Until now it was only reachable throughquery, e.g.:A native
deliveredtofield, which works likereplytoandlist, does better than aqueryin three ways:gmailctl test, which rejectsquerybecause it can't know what an arbitrary query matches.Gmail's filter UI has no field for
deliveredto, but the same is true for cc, bcc, replyto and list, which are already supported natively for the same reasons.The new function is placed right after replyto, which doesn't change the relative order of the existing functions, so the generated queries for existing configs stay the same.
Close #377.