diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a2ff5e1f..432405b9d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ Thanks for checking out Mailspring! We'd love for you to contribute. Whether you're a first-time open source contributor or an experienced developer, there are ways you can help make Mailspring great: -1. Grab an issue tagged with **[Help Wanted](https://github.com/Foundry376/Mailspring/labels/help%20wanted)** and dig in! We try to add context to these issues when adding the label so you know where to get started in the codebase. Be wary working on issues without the **Help Wanted** label - just because someone has created an issue doesn't mean we'll accept a pull request for it. See [Where to Contribute](#where-to-contribute) below for more information. +1. Grab an issue tagged with **[Help Wanted](https://github.com/Foundry376/Mailspring/labels/help%20wanted)** and dig in! We try to add context to these issues when adding the label so you know where to get started in the codebase. Be wary of working on issues without the **Help Wanted** label - just because someone has created an issue doesn't mean we'll accept a pull request for it. See [Where to Contribute](#where-to-contribute) below for more information. 2. Triage issues that haven't been addressed. With a large community of users on many platforms, we have trouble keeping up GitHub issues and moving the project forward at the same time. If you're good at testing and addressing issues, we'd love your help! @@ -74,7 +74,7 @@ From Mailspring, you can open the Developer Tools from the menu: `Menu > Develop We use `prettier` and `eslint` for linting our sources. You can run both of these by running `npm run lint` on the command line. Always do this before submitting a pull request to ensure the CI servers accept your code. -### Discussion Etiquette +#### Discussion Etiquette In order to keep the conversation clear and transparent, please limit discussion to English and keep things on topic with the issue. Be considerate to others and try to be courteous and professional at all times. @@ -83,7 +83,7 @@ In order to keep the conversation clear and transparent, please limit discussion Check out the full issues list for a list of all potential areas for contributions. Note that just because an issue exists in the repository does not mean we will accept a contribution to the core mail client for it. There are several reasons we may not accepts a pull requests, like: -- **Maintainability** - We're *extremely* wary of adding options / preferences and niche behaviors. Our general rule is that the code complexity of adding a preference isn't worth it unless the user base is fairly evenly divided about the desired behavior. [We don't want to end up with this!](https://cloud.githubusercontent.com/assets/1037212/14989123/2a74e810-110b-11e6-8b5d-6f343bca712f.png) +- **Maintainability** - We're *extremely* wary of adding options and preferences for niche behaviors. Email is a wild west, and we can't afford to support every possible configuration. Our general rule is that the code complexity of adding a preference isn't worth it unless the user base is fairly evenly divided about the desired behavior. [We don't want to end up with this!](https://cloud.githubusercontent.com/assets/1037212/14989123/2a74e810-110b-11e6-8b5d-6f343bca712f.png) - **User experience** - We want to deliver a lightweight and smooth mail client, so UX and performance matter a lot. If you'd like to change or extend the UI, consider doing it in a plugin or theme. diff --git a/app/src/flux/attributes/attribute-boolean.es6 b/app/src/flux/attributes/attribute-boolean.es6 index 7fd4b34a2..b6660f063 100644 --- a/app/src/flux/attributes/attribute-boolean.es6 +++ b/app/src/flux/attributes/attribute-boolean.es6 @@ -1,5 +1,5 @@ import Attribute from './attribute'; - +import Matcher from './matcher'; /* Public: The value of this attribute is always a boolean. Null values are coerced to false. @@ -13,6 +13,9 @@ export default class AttributeBoolean extends Attribute { return val; } fromJSON(val) { + // Some attributes we identify as booleans in Mailspring are ints + // in the underlying sync engine for reference-counting purposes. + // Coerce all values > 0 to `true`. return val === 'true' || val / 1 >= 1 || val === true || false; } fromColumn(val) { @@ -22,4 +25,9 @@ export default class AttributeBoolean extends Attribute { const defaultValue = this.defaultValue ? 1 : 0; return `${this.tableColumn} INTEGER DEFAULT ${defaultValue}`; } + equal(val) { + // equal(true) matches all values != 0 + this._assertPresentAndQueryable('equal', val); + return new Matcher(this, val ? '!=' : '=', 0); + } } diff --git a/app/src/flux/attributes/matcher.es6 b/app/src/flux/attributes/matcher.es6 index 8f5b44fec..7ed076292 100644 --- a/app/src/flux/attributes/matcher.es6 +++ b/app/src/flux/attributes/matcher.es6 @@ -79,7 +79,10 @@ class Matcher { switch (this.comparator) { case '=': - return modelValue === matcherValue; + // triple-equals would break this, because we convert false to 0, true to 1 + return modelValue == matcherValue; // eslint-disable-line + case '!=': + return modelValue != matcherValue; // eslint-disable-line case '<': return modelValue < matcherValue; case '>':