mesozoic/gmail-yaml-filters

Create rules in a specific order so that has:userlabels works as a filter condition

Closed this issue · 2 comments

A few of my rules rely on ordering, which I understand it not guaranteed, however it seems to work. The specific requirement is that they test for the presence (or absence) or labels from other rules. This allows me to avoid giant nested structures. I can do this with 'has:userlabels' or 'has:nouserlabels'

Is there any potential for supporting this as a condition?

I had no idea that was possible; neat!

Sorry to say that I have not looked into this. I think it would require some work for the RuleSet class itself, the XML generator, and the uploader. I can see how it would work for generated XML easily enough, but for the uploader you have to take into account any filters that already exist on the server (or always nuke-and-replace, which is slower).

I'd welcome pull requests that implement this, but it will require enough changes to the internals and the command line that we'll definitely need more tests than we have today.

The only catch with sending the rules in order is there needs to be a ~1.5 sec cooldown in between rules sent or it's possible that the API will process and add rule 3 before it is finished processing 2 giving you a order of 1324