Commit graph

366 commits

Author SHA1 Message Date
Ben Gotow 552b66fbaf fix(syncback): Bidirectional transforms, ready-to-send saved state
Summary:
This diff replaces "finalizeSessionBeforeSending" with a
plugin hook that is bidirectional and allows us to put the draft in
the "ready to send" state every time we save it, and restore it to
the "ready to edit" state every time a draft session is created to
edit it.

This diff also significantly restructures the draft tasks:

1. SyncbackDraftUploadsTask:
   - ensures that `uploads` are converted to `files` and that any
     existing files on the draft are part of the correct account.

1. SyncbackDraftTask:
   - saves the draft, nothing else.

3. SendDraftTask
   - sends the draft, nothing else.
   - deletes the entire uploads directory for the draft

Test Plan: WIP

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2753
2016-03-16 19:27:12 -07:00
Jackie Luo 76d478b677 refactor(ui-variables): Clean UI variables for consistency/usage
Summary: Shortens and simplifies UI variables so that unused variables are no longer present.

Test Plan: Tested locally.

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2738
2016-03-15 11:18:50 -07:00
Ben Gotow b75843bbc0 fix(unread): counts should exclude items outside all mail
#1726, #1718
2016-03-14 18:33:04 -07:00
Juan Tejada 0b2d7043d7 fix(specs): Remove fdescribe 2016-03-14 15:39:42 -07:00
Juan Tejada cfbbcd23d3 fix(snooze): Correctly query and create snooze categories per account
Summary:
- Was not properly updating the references to snoozed categories when
  accounts were added or removed
- Update whenCategoriesReady to make sure we listen until category syncing has concluded (Move inside CategoryStore)
- #1676, #1658

Test Plan: - TODO

Reviewers: evan, drew, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2723
2016-03-14 15:36:39 -07:00
Ben Gotow 734a52aa6a fix(config): Move account tokens to system keychain
Summary:
This diff also adds an account version number to the config so that the AccountStore can tell whether it should reload accounts (depending on whether it was the instance making tthe changes.)

This diff also fixes a tiny issue where un-opened composers threw an exception if you changed accounts.

Test Plan: New tests

Reviewers: evan, drew, juan

Reviewed By: juan

Subscribers: juan

Differential Revision: https://phab.nylas.com/D2726
2016-03-14 15:14:08 -07:00
Juan Tejada 346dd80a32 fix(specs) 2016-03-14 11:22:42 -07:00
Juan Tejada 23c68df4c0 fix(sent): Do not allow sent or drafts to be modified
- Specifically, when dragging from the sent perspective, we should not
  allow the sent label to be removed.
- If moved to trash or spam, `all mail` will be correctly removed from
  the thread, but it will keep sent label
- Show sent MailLabel on the threads
2016-03-10 15:44:53 -08:00
Juan Tejada 76036e82bd fix(gmail-labels): Constraint so threads always belong to all,spam or trash
Summary:
- In Gmail all threads /must/ belong to either All Mail, Trash and Spam, and
  they are mutually exclusive, so we need to make sure that any add/remove
  label operation still guarantees that constraint
- Update ChangeLabelsTask to modify the set of labels to add and remove
  based on this rule
- Update tasksFor archiving, moving to trash and moving to spam so they
  don't affect any other labels in the thread, as gmail does.
- Removing from view /will/ remove any current labels, but will also
  move between all mail and trash as needed
- Remove Inbox, Trash and Spam from the CategoryPicker, as Gmail does

Test Plan: - Unit tests

Reviewers: drew, evan, bengotow

Reviewed By: drew, evan, bengotow

Differential Revision: https://phab.nylas.com/D2715
2016-03-10 14:13:31 -08:00
Ben Gotow 96c0b5da29 fix(trash/spam): New inAllMail filter applied to all mailbox views except trash and spam 2016-03-10 12:41:32 -08:00
Ben Gotow f706d4d80f fix(sync): Pull down and associate metadata during initial sync
Summary:
Snooze should wait for categories on all accounts

Fix authPlugin to rembmer `plugin+accountId`, not pluginId, add specs

categories() returned [], categories(acctId) returned {}

dry up sync worker, fetch metadata before anything else

Test Plan: Run tests

Reviewers: drew, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2693
2016-03-10 11:06:06 -08:00
Ben Gotow 041817c589 patch(save): Only save drafts when necessary, avoid sync-engine issues
Summary:
Previously, we have saved drafts back to the user's provider through the sync engine. There are a handful of very serious edge case issues we're working to solve that are creating a bad user experience. (#933, #1175, #1504, #1237)

For now, we're going to change the behavior of N1 to mitagate these issues.

- If you create a draft in N1, we will not sync it to other mail clients while you're working on it.
- If you enable send later, we'll start syncing the draft to the server as before.
- If you created the draft in another client, we'll sync the draft to the server as before.

Fix specs

Test Plan: Run specs

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2706
2016-03-10 11:03:38 -08:00
Ben Gotow b1ab520d0e fix(bodies): Move loading into component, add retry, loading spinner 2016-03-09 19:14:54 -08:00
Juan Tejada e3fc29ee36 remove(popover): Remove Popover in favor of FixedPopover
Summary:
- FixedPopover now correctly adjusts itself when overflowing outside
  window, in all directions
  - Updates styles
  - Adds specs
- Remove Popover and popover.less, and refactor all code that used it in
  favor of the new FixedPopover

Test Plan: Unit tests

Reviewers: drew, evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2697
2016-03-09 10:05:46 -08:00
Evan Morikawa 22dfd4d0c4 fix(spec): fix nylas api specs 2016-03-09 10:03:05 -05:00
Ben Gotow 3e8f7fbfd7 fix(downloads): Properly handle network errors, retries of downloads 2016-03-08 18:32:47 -08:00
Ben Gotow 025d4b4081 fix(launch): Do not create global symlinks to N1 and apm. Closes #1553 2016-03-08 10:34:12 -08:00
Evan Morikawa 0f395b8918 fix(lint): fix linter issues 2016-03-08 13:02:10 -05:00
Drew Regitsky f1d3959591 fix(send): make send/syncback draft tasks cooperate, fix task ordering tracking
Summary:
Fixes an issue with sending where certain conditions could result in a
duplicated message.

Fixes task dependency logic for draft syncback and send. Changes `createdAt`
on tasks to instead be `sequentialId`, assigned when the task is queued, to
track order of enqueueing. Renames `isDependentTask` => `isDependentOnTask`
and adds comments for clarity.

Test Plan:
Specs updated. Might be good to add some later to test this particular
edge case.

Reviewers: juan, evan, bengotow

Reviewed By: evan, bengotow

Differential Revision: https://phab.nylas.com/D2681
2016-03-07 20:14:58 -08:00
Juan Tejada 37af2ba42c fix(remove-from-view): Fix logic for delete/remove-from-view behavior:
Summary:
- Separate gmail's remove-from-view and delete behaviors and write logic
  for each of those
  - Remove MailboxPerspective::{canArchiveThreads, canTrashThreads,
    removeThreads} and some unecessary code in TaskFactory
  - Instead, add MailboxPerspective::tasksForRemovingFromPerspective (I
    know its a bit of a mouthful)
  - I initially tried to put all of the logic for each execution path
    inside the TaskFactory by checking perspective types, but it made
    more sense to use the polymorphism already in place for the different
    perspective types.
  - There is a default delete/remove-from-view behavior which is
    configurable via simple ruleset objects. The gmail behavior is
    configured in this way.
- Update swipe css classes based on destination of threads
- Fixes #1460:
  - Update logic to display archive/trash buttons and context menu options correctly
    when selected threads can be archived/trashed (not based on
    perspective)
  - Same for swiping
- Add a bunch of specs
- Convert some code to ES6
- TODO write some docs for new functions

Test Plan: Unit tests

Reviewers: drew, evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2682
2016-03-07 18:16:37 -08:00
Juan Tejada 848bb09f84 fix(date-utils): Add localization to date formats
Summary:
- Setting the locale in moment was not sufficient to actually use the
  correct localized formats.
- Moment provides localized format via the formats : 'L', 'LL', 'll',
  etc. See: http://momentjs.com/docs/#/displaying/format/
- Updates to set our date formats based on localized formats:
  - Unfortunately, localized formats always contain the year, so I
    manually removed the year from our short format.
- Actually fixes: #1515
- Fixes bug where setting nextWeek or thisWeekend returned incorrect
  date if the current day was saturday or sunday
- Add specs

Test Plan: Unit tests

Reviewers: evan, drew, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2688
2016-03-07 16:44:54 -08:00
Juan Tejada 248467894e fix(lint) 2016-03-04 10:28:48 -08:00
Ben Gotow 7219dd91d7 fix(downloads): Replace stripped extensions, remember folder 2016-03-03 18:00:43 -08:00
Evan Morikawa e7ebf0ba2c feat(quote): add new quoted text detector for quote strings 2016-03-03 17:30:36 -08:00
Evan Morikawa 4e05fc45c8 fix(quoted-text): add test case for intentional quote text failure 2016-03-03 17:30:36 -08:00
Juan Tejada 0fd2d107b2 test(plugins): Add snooze and send later specs
Summary:
- Also refactors the code a bit for testability and maintainability
- Fixes #1515

Test Plan: - Unit tests

Reviewers: evan, drew, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2651
2016-03-03 12:38:42 -08:00
Ben Gotow 9a06db85db fix(drafts): Lock drafts when they're deleted so they can't be revived by deltas
Summary:
When we delete drafts, they can sometimes come back because we receive deltas about them,
find that they're not in the cache, and re-save them.

This diff fixes that by permanently incrementing the optimistic change count, which was also do
to prevent deltas from changing threads while we're in the middle of a request that will change
them further. (This may not actually be necessary anymore, because we'd ignore the delta anyway
due to it's out-of-date version?)

Test Plan: Run a couple new tests

Reviewers: drew, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2665
2016-03-03 12:09:16 -08:00
Ben Gotow 53446f91ae fix(hidden-messages): Address diff feedback from @jstejada 2016-03-02 10:28:32 -08:00
Ben Gotow f413386b80 feat(hidden-messages): Filter trash/spam messages. Fixes #1135
Summary:
By default, the messages in a thread are now filtered to exclude
ones moved to trash or spam. You can choose to view those messages by clicking
the new bar in the message list.

When you view your spam or trash, we only show the messages on those threads
that have been marked as spam/trash.

Test Plan: Run a couple new tests

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2662
2016-03-02 10:05:17 -08:00
Ben Gotow a950b40175 rename(specs): A few more task renames 2016-03-01 17:34:36 -08:00
Ben Gotow 2c28c66a8a test(send): Improved coverage of metadata logic, file uploads
Summary: Just new specs. Tested by manually breaking lots of things in SendDraft

Test Plan: Run new tests

Reviewers: juan, drew, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2649
2016-03-01 17:24:37 -08:00
Evan Morikawa 11c119393e fix(account): re-add token if a new one comes in
Summary: fix(account): allow users to reconnect accounts if auth has failed

Test Plan: manual

Reviewers: bengotow, juan

Differential Revision: https://phab.nylas.com/D2663
2016-03-01 16:02:20 -08:00
Ben Gotow 3fc6582718 es6(*): convert 20+ source files used in example packages to ES2016
There could be a few lurking bugs. Please test!
2016-02-29 18:47:22 -08:00
Juan Tejada c3123b1d45 fix(specs): Update spy on persistModel to reflect actual behavior 2016-02-29 10:37:48 -08:00
Ben Gotow 73ddd39cb2 fix(402s): Handling of Message Rejected, error messages with more detail 2016-02-26 11:40:59 -08:00
Ben Gotow f75eddb518 fix(link/open tracking): Remove intermediate metadata states, extra db lookup, dead code 2016-02-25 12:54:18 -08:00
Ben Gotow e96848653e fix(sync-draft): Accept the thread id given to the draft server-side 2016-02-24 17:20:12 -08:00
Evan Morikawa 9dd7a9600a fix(tracking): fix link tracking and read receipt plugins
Fix broken links in link tracking and read receipts

Fix bug in email frame where it wouldn't adjust the height even when
content changed

MessageItem bodies automatically clear the MessageBodyProcessor cache when
the message contents (including metadata) change.

Remove unused Account stuff from nylas-observables

Plugins appIds properly read if there's an environment set
2016-02-24 12:30:12 -08:00
Ben Gotow 9ef84e476a fix(auth-failure): Warn of disconnect on 403s, fix logic 2016-02-23 18:35:24 -08:00
Ben Gotow f1cd1056cc fix(attachments): fixes + specs for download on-receive option 2016-02-19 18:54:20 -08:00
Ben Gotow 592374c0dc feat(swipe-to-*): Gesture support and animation in thread list
Summary:
This diff does two things:
- It adds a new SwipeContainer that makes it easy to implement swipe gestures. This is built into listTabular, so you can create a list and define onSwipeLeft/Right to enable gestures.

- It adds support for basic add/remove animations to the thread list. This works by adding a CSS transition to `top` and also leaving removed rows around for a specified time. (these times need to match.) Pretty much just cloned the core idea from TimeoutTransitionGroup.

Test Plan: No tests yet

Reviewers: evan, juan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2581
2016-02-19 18:22:28 -08:00
Juan Tejada 0217e5a509 feat(metadata): Switch to storing metadata on models
Summary:
 - Adds a class ModelWithMetadata which models can now extend from
 - Instances of this class can query metadata for a plugin via
   `obj.metadataForPluginId(pluginId)`
 - To observe changes on metadata it is sufficient to observe database changes on
   the model. e.g.:
   `DatabaseStore.findAll(Thread,
   [Thread.attributes.pluginMetadata.contains(pluginId)])`
 - To set metadata a new action has been created: Actions.setMetadata
 - Adds a helper observable in nylas-observables to query for models with
   metadata
 - Merges CreateModelTask and UpdateModelTask into SyncbackModelTask
 - Update SendDraftTask ans SynbackDraftTask to handle metadata changes

Test Plan: - Unit tests

Reviewers: drew, evan, bengotow

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2575
2016-02-17 15:00:33 -08:00
Ben Gotow 2de93c614b fix(contacts): Stop auto-capitalizing phrases and emails. Fixes #1308 2016-02-11 16:30:28 -08:00
Juan Tejada ae2f03ac96 fix(focused-persepective): Init saved perspective correctly
- When accounts changed and the saved perspective could reference
  accounts that no longer exist and cause all sorts of errors. This is
  fixed.
- Add specs
- Fixes some sentry errors
2016-02-09 20:10:33 -08:00
Ben Gotow 71a5662553 🎨: Smaller buttons, smaller toolbar, smaller text
This should not be considered final, but we do plan to shrink the size of the entire UI slightly to match platform conventions.
2016-02-09 19:45:24 -08:00
Ben Gotow 6e49dbd2c3 bump(*): Electron 0.36.7, version to 0.4.6 2016-02-08 18:35:23 -08:00
Ben Gotow 99952bc2fa fix(delete-category): Resolve regression in error message (#1244) 2016-02-08 17:42:48 -08:00
Ben Gotow 9e14f2207f perf(accounts): Use cached contact objects in accountForEmail
This method is called for every contact on a thread in the thread list, so I figured we should see if one version was faster. I ran this test code:

```
d = Date.now(); for(var ii = 0; ii < 10000; ii ++){ $n.AccountStore.accountForEmail("ben.gotow@gmail.com") }; console.log(Date.now() - d);
```

The other approach which calls meUsingAlias takes `3784ms`, and this version which uses the alias contacts cached in aliases() only takes `264ms`. Confirmed that the tests still pass.
2016-02-07 11:23:19 -08:00
Juan Tejada 88b86c2fb4 🎨(contact): Reuse AccountStore.accountForEmail inside isMe 2016-02-07 01:34:30 -08:00
Juan Tejada 58725b98ef fix(account-store): Correctly check alias email inside accountForAlias
- Add spec
2016-02-07 00:39:11 -08:00
Ben Gotow fcc8ca8b07 fix(system-start): Do not continue when checkAvailability returns false 2016-02-06 11:35:01 -08:00
Ben Gotow 57e7df8356 fix(db): Allow string attributes to be null. Never coerce to ""
- Fixes a bug where reply_to_message_id = "" when we receive drafts from the sever.
- In general behavior should be consistent with API. Since they allow null we should too.
2016-02-05 13:49:18 -08:00
Ben Gotow 8a40af6830 fix(labels): Re-order so adding/removing same label does nothing 2016-02-05 12:00:58 -08:00
Ben Gotow 1ca2e930ef perf(threads): Cache aliases to avoid GC thrashing in isMeAccount 2016-02-04 20:13:37 -08:00
Ben Gotow 91240f8979 feat(outbox): Sending status now appears beside drafts
Summary:
This diff adds an "OutboxStore" which reflects the TaskQueue and
adds a progress bar / cancel button to drafts which are currently sending.

- Sending state is different from things like Send later because drafts
  which are sending shouldn't be editable. You should have to stop them
  from sending before editing. I think we can implement "Send Later"
  indicators, etc. with a simple InjectedComponentSet on the draft list
  rows, but the OutboxStore is woven into the DraftList query subscription
  so every draft has a `uploadTaskId`.

- The TaskQueue now saves periodically (every one second) when there are
  "Processing" tasks. This is not really necessary, but makes it super
  easy for tasks to expose "progress", because they're essentially
  serialized and propagated to all windows every one second with the
  current progress value. Kind of questionable, but super convenient.

- I also cleaned up ListTabular and MultiselectList a bit because they
  applied the className prop to an inner element and not the top one.

- If a DestroyDraft task is created for a draft without a server id, it
  ends with Task.Status.Continue and not Failed.

- The SendDraftTask doesn't delete uploads until the send actually goes
  through, in case the app crashes and it forgets the file IDs it created.

Test Plan: Tests coming soon

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2524
2016-02-04 14:14:24 -08:00
Evan Morikawa 918090a4e1 feat(error): improve error reporting. Now NylasEnv.reportError
Summary:
The goal is to let us see what plugins are throwing errors on Sentry.

We are using a Sentry `tag` to identify and group plugins and their
errors.

Along the way, I cleaned up the error catching and reporting system. There
was a lot of duplicate error logic (that wasn't always right) and some
legacy Atom error handling.

Now, if you catch an error that we should report (like when handling
extensions), call `NylasEnv.reportError`. This used to be called
`emitError` but I changed it to `reportError` to be consistent with the
ErrorReporter and be a bit more indicative of what it does.

In the production version, the `ErrorLogger` will forward the request to
the `nylas-private-error-reporter` which will report to Sentry.

The `reportError` function also now inspects the stack to determine which
plugin(s) it came from. These are passed along to Sentry.

I also cleaned up the `console.log` and `console.error` code. We were
logging errors multiple times making the console confusing to read. Worse
is that we were logging the `error` object, which would print not the
stack of the actual error, but rather the stack of where the console.error
was logged from. Printing `error.stack` instead shows much more accurate
stack traces.

See changes in the Edgehill repo here: 8c4a86eb7e

Test Plan: Manual

Reviewers: juan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2509
2016-02-03 18:06:52 -05:00
Evan Morikawa 8b895068e2 feat(metadata): add cloudState that sync with Metadata service
Summary:
Now all plugins get passed a `cloudState` object to their `activate`
method.

The `cloudState` object is an instance of `CloudState` and acts like a
key-value store backed by the yet-to-be-implemented Metadata service.

It has a `get`, `getAll`, and `observe` method. The `observe` method
returns a new `Rx.Observable` for the given key.

It has a `set`, and `unset` method that doesn't actually mutate state, but
rather dispatches new `Task`s to Create, Update, and Delete `Metadata`
objects.

The whole object is backed by `Metadata` objects. Since these are standard
Database Objects that will appear on the delta sync streaming API, any
updates from the server will automatically propagate down to listening
views via the `Rx.Observable`s.

Additionally, there is a new `N1-Send-Later` stub plugin that demonstrates
how to use the `cloudState`.

There are few other minor refactors included in this diff:

**Generic CUD Tasks**: There is now a generic `CreateModelTask`,
`UpdateModelTask`, and `DestroyModelTask`. These can either be used as-is
or trivially overridden to easily update simple objects. Hopefully all of
the boilerplate rollback, error handling, and undo logic won't have to be
re-duplicated on every task. There are also tests for these tasks. We use
them to perform mutating actions on `Metadata` objects.

**New `boundProps` for `InjectedComponents`**: When making the
`N1-Send_later` plugin, I realized that the injected component needed to
get the `cloudState` somehow. Traditionally components would require
Stores and load data that way, but these are setup at `require`-time. Now
that `cloudState` only is available on `activate` we needed a way to get
the data to the components. There's now the concept of `boundProps` which
will be props added to the Component when it gets injected. This required
changing the return signature of `findComponentMatching`, which got
renamed to `findComponentDataMatching`.

**Failing on Promise Rejects**: Turns out that if a Promise rejected
due to an error or `Promise.reject` we were ignoring it and letting tests
pass. Now, tests will Fail if any unhandled promise rejects. This
uncovered a variety of errors throughout the test suite that had to be
fixed. The most significant one was during the `theme-manager` tests when
all packages (and their stores with async DB requests) was loaded. Long
after the `theme-manager` specs finished, those DB requests were
(somtimes) silently failing.

**Globally stub `DatabaseStore._query`**: All tests shouldn't actually
make queries on the database. Furthremore, the `inTransaction` block
doesn't resolve at all unless `_query` is stubbed. Instead of manually
remembering to do this in every test that touches the DB, it's now mocked
in `spec_helper`. This broke a handful of tests that needed to be manually
fixed.

**ESLint Fixes**: Some minor fixes to the linter config to prevent
yelling about minor ES6 things and ensuring we have the correct parser.

Test Plan: new tests

Reviewers: drew, bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2419
2016-02-02 15:28:06 -05:00
Ben Gotow d9c4739f78 fix(contact): Converge on displayName(), don't show account label in ThreadList. Fixes #1157 2016-02-01 19:12:06 -08:00
Juan Tejada 617e2aed09 fix(remove-from-view): Update remove from view (shortcut) behavior
Summary:
- Now behaves exactly like in Gmail:
  - If viewing inbox, it will archive or trash, depending on setting
  - If viewing starred, will unstar
  - If viewing trash, will move to inbox
  - If viewing label, will remove label (no folder support)
  - No op otherwise
- Updates TaskFactory helpers and adds some helper methods
- Updates specs

Test Plan: - Manual

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2492
2016-02-01 17:40:42 -08:00
Juan Tejada 46f331c0b1 fix(alias-list): Editable list wont create empty items
- Update alias coercion to include name by default
2016-02-01 12:45:52 -08:00
Ben Gotow 3453cfecb5 fix(mailto): test case / parsing for url encoded To field 2016-02-01 11:22:23 -08:00
Ben Gotow 2027901deb fix(uploads): Consolidate logic, use Promisify, path.join 2016-01-29 14:45:53 -08:00
Juan Tejada a3b686e546 fix(electron): Update api usage to require('electron') 2016-01-29 14:24:33 -08:00
Ben Gotow f1a9080518 feat(me): Display "Me (Account Label)" in unified inbox 2016-01-29 09:29:25 -08:00
Ben Gotow 21aa4b4291 perf(accounts): Cache accountForId - need ordered map...
In general, we call the functions in AccountStore and CategoryStore / constantly / and inside of critical places like thread list render. Would be nice to create a safe and generic way of caching things and invalidating them when data changes.
2016-01-29 00:42:56 -08:00
Ben Gotow 140162dcd3 fix(db): Pool, flush change records rather than cancel queries 2016-01-28 23:20:19 -08:00
Evan Morikawa 256b240b70 fix(quoted): fix quoted text issue with single blockquotes
Fixes #1084
Also fixes broken tokenizing text field specs
Also protects `MessageBodyExtension`s from errors
2016-01-28 17:25:36 -08:00
Evan Morikawa 15cafbac4d fix(apm): no longer overrides apm
Summary: Fixes #39

Test Plan: new tests

Reviewers: juan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2481
2016-01-28 16:06:27 -08:00
Ben Gotow a4e37c66f4 fix(specs): Re-enable draft-store specs 2016-01-28 15:48:08 -08:00
Ben Gotow 52a7a6625f fix(linter): Switching between Coffee + ES6 is hard... 2016-01-28 14:59:17 -08:00
Ben Gotow d1415585d5 fix(contact-search): Keep only ranked contacts, query for others. Massive perf boost. 2016-01-28 14:56:15 -08:00
Juan Tejada f00f7c56f8 add(specs): Add specs for MailboxPerspective
- Renames canApplyToThreads -> canReceiveThreads and applyToThreads ->
  receiveThreads
- Add initial specs and better documentation for
  MailboxPerspective.canReceiveThreads.
2016-01-28 14:11:50 -08:00
Ben Gotow 63102ba732 fix(message-list): Spec fixes, all stubs need accountId 2016-01-28 11:14:04 -08:00
Juan Tejada 8be8bfcab2 Fix in upload store when deleting draft 2016-01-28 01:29:33 -08:00
Juan Tejada f74ee7b6c2 Fix specs 2016-01-28 00:48:45 -08:00
Juan Tejada 3343000f86 Update file uploads (see details):
- Add uploads field to Message and removes cache from FileUploadsStore
- Updates draft via session from DraftStore
  - This makes everything way cleaner
- This fixes bug when creating draft with uploads and the opening it in
  new window
- Updates specs
2016-01-28 00:33:22 -08:00
Juan Tejada ff3213f003 Rewrite tests for FileUploadStore 2016-01-27 12:33:27 -08:00
Ben Gotow 32ccaad1e7 More spec fixes 2016-01-27 10:31:54 -08:00
Ben Gotow 3b3b19a172 Spec fixes 2016-01-26 19:12:51 -08:00
Ben Gotow 820973cfa5 Fixes to the SendDraftTask 2016-01-26 16:41:49 -08:00
Ben Gotow bbe2f80320 A few other changes 2016-01-26 15:44:44 -08:00
Ben Gotow c8bd09a260 Begin cleanup of Send Task 2016-01-26 15:44:44 -08:00
Ben Gotow 0ef4911b22 Merge branch 'master' into unified-inbox
# Conflicts:
#	internal_packages/feedback/lib/feedback-button.cjsx
#	internal_packages/thread-list/lib/thread-list.cjsx
#	src/flux/stores/draft-store.coffee
2016-01-25 17:28:29 -08:00
Ben Gotow e4553ffb1e Fix drafts 2016-01-25 16:37:34 -08:00
Evan Morikawa 392753233e feat(send): Send and Archive
Summary: Send and Archive plus a new setting.

Test Plan: new tests

Reviewers: bengotow, juan

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2446
2016-01-25 14:14:09 -08:00
Ben Gotow c6bf3eba01 Fix for selection update issue, delete items + scroll up issue 2016-01-25 13:44:05 -08:00
Juan Tejada 84bf7dded6 Fix NylasAPI specs and ContactStore specs 2016-01-25 12:12:16 -08:00
Ben Gotow c9e5b68f16 More database-related spec fixes 2016-01-25 11:35:23 -08:00
Ben Gotow 6a28cd8cda DatabaseTransaction / QueryBuilder spec fixes 2016-01-25 11:11:57 -08:00
Ben Gotow fcb75fbf1a CategoryPicker / PerspectiveStore spec fixes 2016-01-25 11:07:40 -08:00
Juan Tejada 01ad283754 Fix more task specs 2016-01-22 16:55:29 -08:00
Juan Tejada c5dc9544e1 Fix specs for destroy and syncback category tasks 2016-01-22 14:52:19 -08:00
Juan Tejada ad05cc05cc Fix MutliSelectSplitInteractionHandler specs 2016-01-22 13:47:54 -08:00
Ben Gotow d842428880 Rename formatResult, don't assume it's an array 2016-01-22 11:45:36 -08:00
Juan Tejada 6b144b867d Fix MultiSelectListInteractionHandlers specs 2016-01-21 17:07:57 -08:00
Juan Tejada f2acba48ee Add account switcher back to sidebar:
- Account switcher can now switch between all accounts and each account
- Updates FocusedPerspectiveStore and Actions.focusDefaultMailboxPerspectiveForAccounts
  to focus a perspective for accountIds instead of for a single account,
  and updates methods
  - Adds helpers to CategoryStore and MailboxPerspective
  - Updates key commands to allow switch to unified inbox
2016-01-19 23:42:50 -08:00
Ben Gotow 1e5b26a818 Unified inbox mailbox perspectives working (sidebar disabled atm) 2016-01-18 00:47:04 -08:00
Evan Morikawa 74e21bce16 feat(tasks): add Create, Update, Destroy tasks plus spec & lint fixes
Summary:
1. **Generic CUD Tasks**: There is now a generic `CreateModelTask`,
`UpdateModelTask`, and `DestroyModelTask`. These can either be used as-is
or trivially overridden to easily update simple objects. Hopefully all of
the boilerplate rollback, error handling, and undo logic won't have to be
re-duplicated on every task. There are also tests for these tasks. We use
them to perform mutating actions on `Metadata` objects.

1. **Failing on Promise Rejects**: Turns out that if a Promise rejected
due to an error or `Promise.reject` we were ignoring it and letting tests
pass. Now, tests will Fail if any unhandled promise rejects. This
uncovered a variety of errors throughout the test suite that had to be
fixed. The most significant one was during the `theme-manager` tests when
all packages (and their stores with async DB requests) was loaded. Long
after the `theme-manager` specs finished, those DB requests were
(somtimes) silently failing.

1. **Globally stub `DatabaseStore._query`**: All tests shouldn't actually
make queries on the database. Furthremore, the `inTransaction` block
doesn't resolve at all unless `_query` is stubbed. Instead of manually
remembering to do this in every test that touches the DB, it's now mocked
in `spec_helper`. This broke a handful of tests that needed to be manually
fixed.

1. **ESLint Fixes**: Some minor fixes to the linter config to prevent
yelling about minor ES6 things and ensuring we have the correct parser.

Test Plan: new tests

Reviewers: bengotow, juan, drew

Differential Revision: https://phab.nylas.com/D2419

Remove cloudState and N1-Send-Later
2016-01-15 15:16:21 -05:00
Ben Gotow 273679a861 DataView => ListDataSource 2016-01-14 12:26:54 -08:00
Ben Gotow 88b901d8a5 New QueryRange specs, fixes 2016-01-14 12:03:06 -08:00
Ben Gotow 9814d80d5a New MutableQueyResultSet specs, fixes 2016-01-14 11:25:52 -08:00
Ben Gotow cb5f2985ef Merge branch 'master' into unified-inbox
# Conflicts:
#	spec/stores/file-download-store-spec.coffee
2016-01-13 17:20:34 -08:00
Juan Tejada c5d4b10c7d Fix CategoryStore sorting:
- Also fix Category model specs
2016-01-13 14:20:44 -08:00
Ben Gotow 760c8769b3 fix(accounts): Spec fixes for a03e8f70 2016-01-12 15:16:59 -08:00
Ben Gotow 619c753cf3 fix(downloads): Escape all illegial path chars, don't make regex from path.sep 2016-01-12 13:52:01 -08:00
Ben Gotow 5c491d16af Merge branch 'master' into unified-inbox
# Conflicts:
#	internal_packages/events/lib/event-header.cjsx
#	spec/stores/file-download-store-spec.coffee
#	spec/tasks/event-rsvp-spec.coffee
#	src/flux/tasks/event-rsvp.coffee
2016-01-12 08:20:55 -08:00
Juan Tejada 7f2c8481ff Fix more specs:
- SearchBar
- EventRSVPTask
- ContactStore
2016-01-11 16:14:21 -08:00
Ben Gotow 10cb195226 Search bar fixes 2016-01-11 15:58:10 -08:00
Ben Gotow a8c563f09d Updated QuerySubscription specs 2016-01-11 15:24:46 -08:00
Ben Gotow 04c6be4dfe AccountStore no longer tracks index, Actions.selectAccount gone 2016-01-11 14:11:48 -08:00
Juan Tejada 53d26b38a8 Fix Contact and Thread specs 2016-01-11 13:58:22 -08:00
Ben Gotow e62ddf5d63 Fix ModelViewSelection specs 2016-01-11 13:47:39 -08:00
Juan Tejada e803b66a1a Wrap FileDownloadStore in describe block 2016-01-11 13:44:54 -08:00
Ben Gotow a4d33be4f2 More spec fixes 2016-01-11 13:40:42 -08:00
Juan Tejada 9847e58b7f Fix CategoryPicker specs
- Add NylasUtils.mockObservable helper
2016-01-11 13:23:59 -08:00
Ben Gotow 2c74b38323 fixes for draft store specs, contact.isMe now returns true if it matches any account 2016-01-11 13:23:35 -08:00
Ben Gotow 6a735da033 fix(rsvp): Check that you are a participant, support aliases. Fixes #962 2016-01-11 12:20:26 -08:00
Ben Gotow f3464c7db3 fix(downloads): Replace path.sep when saving files - Sentry 8749 2016-01-11 11:49:05 -08:00
Evan Morikawa 1de3a47077 feat(composer): can outdent blockquotes allowing you to reply inline
Summary:
You can now break up blockquotes (as in quoted text areas) by pressing
"delete" at the start of a line. This allows you to reply inline.

Test Plan: new tests

Reviewers: bengotow, juan

Reviewed By: bengotow, juan

Differential Revision: https://phab.nylas.com/D2421
2016-01-11 14:46:20 -05:00
Ben Gotow 55f1c537e2 fix(quoted-text): Fix + test case for Sentry 8323, body el is quoted text 2016-01-11 11:14:34 -08:00
Juan Tejada d265bf1248 fix(category-store): Fix issue with observables in CategoryStore
- Removes use of observables from category store and keeps a big cache
  of categories per account
- Upates Category Observables with new helper observables
- Updates CategoryPicker and AccountSidebarStore to use observables
- Misc fixes
2016-01-08 18:03:18 -08:00
Ben Gotow 2ddafe7154 Rename MailViewFilter => MailboxPerspective 2016-01-08 14:58:31 -08:00
Ben Gotow f026974bae Merging in new observables for thread list
commit 7a67c1fd349c575a91b162024cc03050e86574c9
Author: Ben Gotow <bengotow@gmail.com>
Date:   Fri Jan 8 11:14:07 2016 -0800

    WIP

commit 891f23487827a447ec95406ef26f1473a0c07de6
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed Jan 6 15:25:09 2016 -0800

    WIP

commit 3c323cd4beb2df2fae2439a556d3129404d942cc
Author: Ben Gotow <bengotow@gmail.com>
Date:   Mon Jan 4 17:46:11 2016 -0800

    WIP

commit ec7090ea9e1969fea2ea583f80a9a2ac41e6c8b0
Author: Ben Gotow <bengotow@gmail.com>
Date:   Mon Jan 4 17:22:07 2016 -0800

    Remove unused LRUCache

commit e10c3919559d3c364cb7bb94d19094a2444c10f3
Author: Ben Gotow <bengotow@gmail.com>
Date:   Mon Jan 4 16:21:37 2016 -0800

    rm(database-view): Performance refactor of thread-list

    Summary:
    This diff removes the old DatabaseView class, which included lots of gross optimizations that have since been duplicated in QuerySubscription and makes the thread list use the QuerySubscription class.

    This diff also substantially replaces the QuerySubscription class. The new implementation actually makes more queries but is less gross and more straightforward. It leverages a couple findings from database profiling:

    - Because of the sqlite page cache, asking for ids you've previously asked for is very fast.
        + Don't bother sorting in memory to avoid a query, just ask for ids again and fill in any missing objects.
    - Loading and inflating models is 4x+ slower than just grabbing ids

    I've also added more convenience classes around database queries:
    - QueryRange: Represents {offset, limit}, and can do boolean intersections
    - QueryResultSet: Better than passing an array of 50 items when you really mean items 150-200. Also tries hard to be immutable.

    This diff doesn't fully remove the concept of a "ModelView" because it's used /everywhere/ in the multiselect list source. There's a small shim that we can remove when we refactor that code. Ideally, I think we should rename ModelView to "MultiselectListDataSource" to follow iOS conventions (eg UITableViewDataSource). RIP 80char lines?

    Test Plan: They've gone to hell. WIP.

    Reviewers: evan, juan

    Differential Revision: https://phab.nylas.com/D2408

commit 32607eee8aafb7fa98b866347bdd2c0b963a602c
Author: Ben Gotow <bengotow@gmail.com>
Date:   Mon Jan 4 09:56:34 2016 -0800

    WIP

commit 5ab5fe74e94db6904bd77d224720ad9fc69fe6a7
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed Dec 30 22:56:46 2015 -0800

    redo scrollbars to not require counts

commit 361bb192d072dc8a69fd3ef143cad7bed214ebdc
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed Dec 30 17:50:57 2015 -0800

    wip

commit 079394de1cc3344fb6568efe00a52d7fc97fbd27
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed Dec 30 13:49:11 2015 -0800

    wip

commit 65142be03c27c653fe1147fdde6c2f9b046ade22
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed Dec 30 01:23:20 2015 -0800

    wip

commit 5d412ec276be1104175ad0f43c9d54e1cea857bf
Author: Ben Gotow <bengotow@gmail.com>
Date:   Tue Dec 29 22:49:58 2015 -0800

    Refactor start

commit d2b6eea884fcd2bd81ebe3985f2b2636a510c493
Author: Ben Gotow <bengotow@gmail.com>
Date:   Tue Dec 29 18:51:53 2015 -0800

    RIP DatabaseView
2016-01-08 14:31:33 -08:00
Juan Tejada 9f998d1964 refactor(rip-current-account): Rips out AccountStore.current
Summary:
- WIP: Need to fix tests and some errors!
- Refactors Category class to hold information about its type
- Refactors CategoryStore to rely on observables instead of local caches
- Adds and updates Observables and helpers
- Refactors ContactStore to hold entire cache of contacts instead of per
  current account
  - Same for ContactRankingStore and other stores
- Refactors method names for AccountStore + some helpers
- Updates MailViewFilter to hold an account
  - Adds basic Unified filter
- Replaces AccountStore.current calls with either:
  - The account of the currently focused MailViewFilter
  - The account associated with a thread, message, file, etc...
  - A parameter to be passed in
  - Arbitrarily, the first account in the AccountsStore

Test Plan: - Unit tests

Reviewers: evan, bengotow

Differential Revision: https://phab.nylas.com/D2423
2016-01-08 14:22:13 -08:00
Evan Morikawa e5efa80216 test(draft): new tests for promise chain in send draft 2016-01-08 10:57:48 -08:00
Ben Gotow 7474c79c61 Revert "bump(electron): 0.35.4 => 0.36.2"
This reverts commit da607dd508.
2016-01-08 10:06:16 -08:00
Ben Gotow da607dd508 bump(electron): 0.35.4 => 0.36.2 2016-01-06 13:20:27 -08:00
Juan Tejada 53b933f676 fix(extensions): Add missing return values 2016-01-04 13:23:45 -05:00
Juan Tejada 141b2e73c9 fix(extensions):Add missing api adapters for ComposerExtension methods 2016-01-04 10:52:39 -05:00
Juan Tejada cd1ee3f672 fix(extension-adapter): Update adapter to support all versions of extension api we've used
Summary:
- Rewrites composer extension adpater to support all versions of the
  ComposerExtension API we've ever declared. This will allow old plugins (or
  plugins that haven't been reinstalled after update) to keep functioning
  without breaking N1
- Adds specs

Test Plan: - Unit tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2399
2015-12-30 15:11:37 -05:00
Juan Tejada 56258991fb fix(composer-focus): Fix focus behavior + update InjectedComponent props
Summary:
- Fixes bug with Composer focus caused by injected component. The composer body
  was being focused, but the cursor remained at the beginning of the content
  instead of at the end. This was caused because the focus method was being
  called before the content had actually been rendered to the dom.
  - Adds a callback to check when injected comp was actually rendered, and uses
    that to focus the body at the correct time.
  - Updates specs
- Updates behavior of focusing composer body when selecting threads in split
  mode --  resolves #T3444
  - It will focus the body when a thread is selcted via a click
  - It wont focus the body when a thread is selected via arrow keys
  - It will focus the body when a new inline reply is created
  - Updates specs

Test Plan: - Unit tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2393
2015-12-29 21:28:15 -05:00
Ben Gotow 7233decbe8 Merge pull request #792 from Sumukh/at-character-parse
Names with @ are included in the contact name.
2015-12-29 12:20:00 -08:00
Ben Gotow 0a5c66f4cc fix(regex): Chop leading '/" off emails if they are wrapped in quotes 2015-12-28 18:39:06 -08:00
Ben Gotow d911793bef fix(mail-rules): Catch and disable mail rules building bad actions 2015-12-28 18:39:06 -08:00
Ben Gotow 47b0ab5c97 fix(mailto): Parse query string manually to account for unencoded body (Fixes #815) 2015-12-28 13:58:24 -08:00
Ben Gotow 8c965e4d7b fix(aliases): Recognize that email sent to alias is to "me" 2015-12-28 12:13:05 -08:00
Ben Gotow 606909e256 feat(mail-rules): Per-account mail rules filter incoming, existing mail
Summary:
Originally, this was going to be a totally independent package, but
I wasn't able to isolate the functionality and get it tied in to
the delta-stream consumption. Here's how it currently works:

- The preferences package has a new tab which allows you to edit
  mail filters. Filters are saved in a new core store, and a new
  stock component (ScenarioEditor) renders the editor. The editor
  takes a set of templates that define a value space, and outputs
  a valid set of values.

- A new MailFilterProcessor takes messages and creates tasks to
  apply the actions from the MailFiltersStore.

- The worker-sync package now uses the MailFilterProcessor to
  apply filters /before/ it calls didPassivelyReceiveNewModels,
  so filtrs are applied before any notifications are created.

- A new task, ReprocessMailFiltersTask allows you to run filters
  on all of your existing mail. It leverages the existing TaskQueue
  architecture to: a) resume where it left off if you quit midway,
  b) be queryable (for status) from all windows and c) cancelable.
  The TaskQueue is a bit strange because it runs performLocal and
  performRemote very differently, and I had to use `performRemote`.
  (todo refactor soon.)

This diff also changes the EditableList a bit to behave like a
controlled component and render focused / unfocused states.

Test Plan: Run tests, only for actual filter processing atm.

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2379
2015-12-23 02:19:32 -05:00
Juan Tejada e5213eae6f fix(specs): Fix and update QuerySubscription specs
- Updates test scenario to test for when the new item already exists in
the set with the same clientId but a new serverId
2015-12-22 14:30:28 -08:00
Evan Morikawa 3dbdd5cfd6 fix(spec): fix send-draft spec to test for include 2015-12-22 10:36:25 -08:00
Evan Morikawa 2aae075126 refactor(contenteditable): new ContenteditableExtension API
Summary:
This provides a new API for `ContenteditableExtension`s. Instead of
manually manipulating the raw DOM and `Selection` objects, there's a new
`Editor` interface that encapsulates it and provides helper methods.

You can now do:

      editor.select(someNode).createLink("foo").collapseToEnd()

Now raw methods like `execCommand` ONLY show up in the `Editor` interface
as well as most of the raw `Selection` APIs.

There are also more integration tests :)

Another major goal was cleaning up the contenteditable file itself. To
that end:

1. The DOMNormalizer got pulled out into its own extension
1. The TabManager is now its own extension
1. Url wrangling got moved into the FloatingToolbar control
1. There is now the concept of a `ContenteditableService`, which are
tightly-couple blocks of code separated out into logical units. These are
dependent on the core state, innerState, and props and are not full
extensions.
1. `MouseService` now handles all the click event logic
1. `ClipboardService` was modified to the new service architecture

Test Plan: script/grunt run-integration-tests

Reviewers: drew, juan, bengotow

Reviewed By: juan, bengotow

Differential Revision: https://phab.nylas.com/D2367
2015-12-21 19:58:01 -08:00
Evan Morikawa a267ccd0bc fix(draft): New Send Draft logic
Summary:
This is a WIP for the new send draft logic.

I'll add tests then update the diff

Test Plan: todo

Reviewers: bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2341
2015-12-21 11:50:52 -08:00
Sumukh Sridhara 78d8a1a245 Names with @ are included in the contact name. Resolves #713 2015-12-21 03:31:37 -08:00
Juan Tejada b559d41bed feat(editor-region): Add support to register components as editors
Summary:
- The main purpose of this is to be able to properly register the editor for the markdown plugin (and any other plugins to come)

- Refactors ComposerView and Contenteditable ->
  - Replaces Contenteditable with an InjectedComponent for a new region role:
    "Composer:Editor"
  - Creates a new component called ComposerEditor, which is the one that is
    being registered by default as "Composer:Editor"
  - I used this class to try to standardize the props that should be
    passed to any would be editor Component:
    - Renamed a bunch of the props which (I think) had a bit of
      confusing names
    - Added a bunch of docs for these in the source file, although
      I feel like those docs should live elsewhere, like in the
      ComponentRegion docs.
  - In the process, I ended up pulling some stuff out of ComposerView and
    some stuff out of the Contenteditable, namely:
    - The scrolling logic to ensure that the composer is visible while
      typing was moved outside of the Contenteditable -- this feels more
      like the ComposerEditor's responsibility, especially since the
      Contenteditable is meant to be used in other contexts as well.
    - The ComposerExtensions state; it feels less awkward for me if this
      is inside the ComposerEditor because 1) ComposerView does less
      things, 2) these are actually just being passed to the
      Contenteditable, 3) I feel like other plugins shouldn't need to
      mess around with ComposerExtensions, so we shouldn't pass them to the
      editor. If you register an editor different from our default one,
      any other ComposerExtension callbacks will be disabled, which
      I feel is expected behavior.
  - I think there is still some more refactoring to be done, and I left some TODOS
    here and there, but I think this diff is already big enough and its a minimal
    set of changes to get the markdown editor working in a not so duck
    tapish way.
- New props for InjectedComponent:
  - `requiredMethods`: allows you to define a collection of methods that
    should be implemented by any Component that registers for your
    desired region.
    - It will throw an error if these are not implemented
    - It will automatically pass calls made on the InjectedComponent to these methods
      down to the instance of the actual registered component
    - Would love some comments on this approach and impl
  - `fallback`: allows you to define a default component to use if none were
    registered through the ComponentRegistry
- Misc:
  - Added a new test case for the QuotedHTMLTransformer
- Tests:
  - They were minimally updated so that they don't break, but a big TODO
    is to properly refactor them. I plan to do that in an upcoming
    diff.

Test Plan: - Unit tests

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2372
2015-12-18 11:06:44 -08:00
Ben Gotow a14a5212ac feat(transactions): Explicit (and faster) database transactions
Summary:
Until now, we've been hiding transactions beneath the surface. When you call persistModel, you're implicitly creating a transaction.
You could explicitly create them with `atomically`..., but there were several critical problems that are fixed in this diff:

- Calling persistModel / unpersistModel within a transaction could cause the DatabaseStore to trigger. This could result in other parts of the app making queries /during/
  the transaction, potentially before the COMMIT occurred and saved the changes. The new, explicit inTransaction syntax holds all changes until after COMMIT and then triggers.

- Calling atomically and then calling persistModel inside that resulted in us having to check whether a transaction was present and was gross.

- Many parts of the code ran extensive logic inside a promise chained within `atomically`:

  BAD:

```
  DatabaseStore.atomically =>
   DatabaseStore.persistModel(draft) =>
     GoMakeANetworkRequestThatReturnsAPromise
```

OVERWHELMINGLY BETTER:

```
  DatabaseStore.inTransaction (t) =>
     t.persistModel(draft)
  .then =>
    GoMakeANetworkRequestThatReturnsAPromise
```

Having explicit transactions also puts us on equal footing with Sequelize and other ORMs. Note that you /have/ to call DatabaseStore.inTransaction (t) =>. There is no other way to access the methods that let you alter the database. :-)

Other changes:
- This diff removes Message.labels and the Message-Labels table. We weren't using Message-level labels anywhere, and the table could grow very large.
- This diff changes the page size during initial sync from 250 => 200 in an effort to make transactions a bit faster.

Test Plan: Run tests!

Reviewers: juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D2353
2015-12-17 11:46:05 -08:00
Juan Tejada 9d77d6399d fix(editable-list): Prevent empty selection on esc pressed + other fixes
- When prop specified to not allow empty selection it should also
prevent it from being cleared when pressing Esc while focusing the list
- Adds a default value to the edit item input
- Updates specs
- Updates styles
2015-12-14 14:29:45 -08:00
Juan Tejada c0a5e0d715 refactor(extensions): Move extensions outside of flux/ folder
Not really related to flux, makes more sense to be inside src/
2015-12-13 23:33:42 -08:00
Juan Tejada 75fb478dd7 fix(warnings): Remove deprecate warnings from specs 2015-12-13 23:32:24 -08:00
Evan Morikawa e83c16ec21 fix(spellcheck): let win < 8 fallback to hunspell 2015-12-11 16:41:41 -05:00
Evan Morikawa ed805869f2 fix(spellcheck): add tests and merge in Linux changes 2015-12-11 15:36:13 -05:00
mbilker 3d4b86dc5d spec(spellchecker): handle some weird Linux cases
Linux returns ['asked', 'acidify', 'Assad'] for the string "asdfk"
which seems normal to me. Why do OS X and/or Windows return [] for
that string? That seems weird, so I just broke the spec to run different
specs on different platforms.
2015-12-11 15:36:12 -05:00