Commit graph

2231 commits

Author SHA1 Message Date
Ben Gotow
e09d3e3e75 feat(trash): Trash for Gmail, and architectural changes for common tasks
Summary:
This diff centralizes logic for creating common tasks for things like moving to trash, archive, etc. TaskFactory exposes a set of convenience methods and hides the whole "and also remove the current label" business from the user.

This diff also formally separates the concept of "moving to trash" and "archiving" so that "remove" isn't used in an unclear way.

I also refactored where selection is managed. Previously you'd fire some action like archiveSelection and it'd clear the selection, but if you selected some items and used another method to archive a few, they were still selected. The selection is now bound to the ModelView as intended, so if items are removed from the modelView, they are removed from it's attached selection. This means that it shouldn't /technically/ be possible to have selected items which are not in view.

I haven't refactored the tests yet. They are likely broken...

Fix next/prev logic

Test Plan: Run tests

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2157
2015-10-21 10:38:00 -07:00
Ben Gotow
fc252673ab fix(toolbars): Cross disolve toolbar items on a one-off basis
Summary:
This diff removes the timeout transition group from the sheet-toolbar, which was causing toolbar items to fade when columns were opened / closed and they were moved from column to column.

Instead, I'm just animating the message toolbar items, which are one of the few sets of toolbar items that really should fade, and do so as an entire set.

I've also renamed the "sheet-toolbar" animation to "opacity-125ms". I think it'd be cool to create a standard set of these animations, but I didn't see any others it would make sense to create generic names for yet. (The others have weird timings or are bound up inside packages).

Resolves Github #90

Test Plan: No new tests

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2159
2015-10-21 10:34:14 -07:00
Evan Morikawa
092c28d2c0 fix(tasks): don't continue if dependent task fails
Summary:
Fixes T4291

If I made a final edit to a pre-existing draft and sent, we'd queue a
`SyncbackDraftTask` before a `SendDraftTask`. This is important because
since we have a valid draft `server_id`, the `SendDraftTask` will send by
server_id, not by POSTing the whole body.

If the `SyncbackDraftTask` fails, then we had a very serious issue whereby
the `SendDraftTask` would keep on sending. Unfortunately the server never
got the latest changes and sent the wrong version of the draft. This
incorrect version would show up later when the `/send` endpoint returned
the message that got actually sent.

The solution was to make any queued `SendDraftTask` fail if a dependent
`SyncbackDraftTask` failed.

This meant we needed to make the requirements for `shouldWaitForTask`
stricter, and block if tasks failed.

Unfortunatley there was no infrastructure in place to do this.

The first change was to change `shouldWaitForTask` to `isDependentTask`.
If we're going to fail when a dependent task fails, I wanted the method
name to reflect this.

Now, if a dependent task fails, we recursively check the dependency tree
(and check for cycles) and `dequeue` anything that needed that to succeed.

I chose `dequeue` as the default action because it seemed as though all
current uses of `shouldWaitForTask` really should bail if their
dependencies fail. It's possible you don't want your task dequeued in this
dependency case. You can return the special `Task.DO_NOT_DEQUEUE_ME`
constant from the `onDependentTaskError` method.

When a task gets dequeued because of the reason above, the
`onDependentTaskError` callback gets fired. This gives tasks like the
`SendDraftTask` a chance to notify the user that it bailed. Not all tasks
need to notify.

The next big issue was a better way to determine if a task truely errored
to the point that we need to dequeue dependencies. In the Developer Status
area we were showing tasks that had errored as "Green" because we caught
the error and resolved with `Task.Status.Finished`. This used to be fine
since nothing life-or-death cared if a task errored or not. Now that it
might cause abortions down the line, we needed a more robust method then
this.

For one I changed `Task.Status.Finished` to a variety of finish types
including `Task.Status.Success`. The way you "error" out is to `throw` or
`Promise.reject` an `Error` object from the `performRemote` method. This
allows us to propagate API errors up, and acts as a safety net that can
catch any malformed code or unexpected responses.

The developer bar now shows a much richer set of statuses instead of a
binary one, which was REALLY helpful in debugging this. We also record
when a Task got dequeued because of the conditions introduced here.

Once all this was working we still had an issue of sending old drafts.

If after a `SyncbackDraftTask` failed, now we'd block the send and notify
the users as such. However, if we tried to send again, there was a
separate issue whereby we wouldn't queue another `SyncbackDraftTask` to
update the server with the latest information. Since our changes were
persisted to the DB, we thought we had no changes, and therefore didn't
need to queue a `SyncbackDraftTask`.

The fix to this is to always force the creation of a `SyncbackDraftTask`
before send regardless of the state of the `DraftStoreProxy`.

Test Plan: new tests. Lots of manual testing

Reviewers: bengotow

Reviewed By: bengotow

Subscribers: mg

Maniphest Tasks: T4291

Differential Revision: https://phab.nylas.com/D2156
2015-10-21 10:33:43 -07:00
Ben Gotow
87f867c9d4 Merge pull request #112 from ryanpcmcquen/patch-1
fix(validation): Allow for TLDs that are more than 4 characters
2015-10-21 10:25:31 -07:00
Ryan P.C. McQuen
895b77a515 fix email validation
fixes https://github.com/nylas/N1/issues/111
2015-10-21 10:04:22 -07:00
Nate Henry
57b608e464 Added eas_server_host field
eas_server_host field added to allow for specifying the Exchange server
if necessary.
2015-10-21 11:33:11 -04:00
Ben Gotow
68323f05f7 ci(mac): Rename the app Nylas N1 on the Mac 2015-10-20 18:36:39 -07:00
Ben Gotow
e12ab4f753 ci(win): N1.exe => N1Setup.exe (it's an installer) 2015-10-20 17:34:35 -07:00
Ben Gotow
86bae4f239 bump(version): 0.3.17 2015-10-20 15:06:36 -07:00
Ben Gotow
2a9b5b7ea1 ci(mac): Fix zip creation and upload for updater 2015-10-20 14:24:51 -07:00
Ben Gotow
f76408fc24 ci(*): mkrpm only works on Fedora build machines, need to configure one 2015-10-20 13:43:12 -07:00
Ben Gotow
4fe56077bd ci(*): Use publish-nylas-build on Linux 2015-10-20 13:31:09 -07:00
Ben Gotow
50469e487d ci(*): Put builds in /version/platform/arch 2015-10-19 18:44:58 -07:00
Ben Gotow
1399685415 ci(*): Put builds in subdirectories, better for Squirrel.Win 2015-10-16 17:06:09 -07:00
Ben Gotow
31e0c570cf ci(*): Prevent external folks from posting to slack 2015-10-16 15:46:09 -07:00
Ben Gotow
84a8b4f98f ci(*): Fix Mac build filenames, zip uploads 2015-10-16 15:26:23 -07:00
Ben Gotow
584da13788 ci(*): Put the commit hashes back in release filenames 2015-10-16 14:01:29 -07:00
Ben Gotow
9cae62dc63 ci(win): Fix build tasks to enable windows CI builds 2015-10-15 17:54:09 -07:00
Ben Gotow
0084306a69 fix(thread-list): stop thread-icons from shrinking, justify participants explicitly 2015-10-14 18:05:29 -07:00
Ben Gotow
31991d370e fix(config): new mail sounds on by default, change config keypath
unread-notifications.sounds => core.notifications.sounds
2015-10-14 17:11:36 -07:00
Ben Gotow
ff34e7c5e8 fix(bootstrap): Don't fail when path contains spaces 2015-10-14 10:46:27 -07:00
Ben Gotow
56ef02009a fix(contributing): Clarify setup instructions for open source stack 2015-10-13 12:04:23 -07:00
Ben Gotow
7431f0b434 bump(version): 0.3.16 2015-10-12 14:31:36 -07:00
Ben Gotow
c7b2a69926 fix(sidebar): Prevent white top border in all scenarios 2015-10-12 11:14:44 -07:00
Ben Gotow
8d627b5cae fix(sidebar): Remove top margin causing white border 2015-10-12 11:04:27 -07:00
Ben Gotow
1ea7a3285e fix(feedback): Make button slightly smaller, less obtrusive 2015-10-12 11:04:27 -07:00
Ben Gotow
5155db25d5 fix(thread-list): Enable drag and drop in narrow view 2015-10-12 11:04:27 -07:00
Ben Gotow
8c22f6bf65 fix(html-parser): Never blow up, just send us HTML parsing errors 2015-10-12 11:04:27 -07:00
Evan Morikawa
2859baa134 fix(contact): fix bug where malformed contacts threw an error
Summary:
Also added tests to catch the case
Fixes T4290

Test Plan: new tests

Reviewers: bengotow

Reviewed By: bengotow

Maniphest Tasks: T4290

Differential Revision: https://phab.nylas.com/D2153
2015-10-12 14:03:39 -04:00
Ben Gotow
f18096c07a Merge pull request #79 from digitalmaster/patch-1
Fix Broken link to DraftStoreExtensions.md
2015-10-12 10:27:29 -07:00
solnj
3c243b9345 fix(script): allow x64 build on Windows
Electron is available for 64-bit Windows machines(https://github.com/atom/electron/issues/980), so we don't need the 32-bit check anymore. Reference: https://github.com/nylas/N1/issues/28
2015-10-12 11:02:07 -04:00
Jose Browne
31cf0bc348 Fix Broken link to DraftStoreExtensions.md 2015-10-11 17:36:13 -07:00
Ben Gotow
0ad7a2f716 fix(updater): Check less frequently, stop when update ready to install 2015-10-11 01:58:53 -07:00
Ben Gotow
01a3fa3876 fix(intercom): Badge the intercom button, don't use safe-ipc 2015-10-09 16:12:52 -07:00
Ben Gotow
62bd11b6ad revert(electron) 0.30.8 introduced a regression in --webkit-app-region: drag 2015-10-09 16:12:52 -07:00
Evan Morikawa
676cb77e7b fix(theme): more consistent styles for dark-mode theme 2015-10-09 16:05:26 -07:00
Evan Morikawa
abc4a6116e fix(specs): Fix intermittent async error and max event listener leak
An absolute ContactStore spec was causing the listener leak by
re-initializing the store and not cleaning it up.

Intermittent theme manager failing spec might be caused due to timing of
the theme activation
2015-10-09 15:42:37 -07:00
Ben Gotow
ecf120729a fix(specs): sanitize-html update seems to have caused regression 2015-10-09 14:39:53 -07:00
Ben Gotow
7ad57680ca fix(contacts): Emails only valid if the entire string is the email. (Sentry 2991) 2015-10-09 14:30:08 -07:00
Ben Gotow
a84787859c fix(quoted-html): Fix null reference error, resolves Sentry 3264 2015-10-09 14:12:27 -07:00
Ben Gotow
9107bc325e fix(specs): ContactStore spec fixes for new contact ranking support 2015-10-09 13:42:24 -07:00
Ben Gotow
d1be3ac0f2 rollback(*): Move back SQLite upgrade after crashing in popout drafts 2015-10-09 13:25:39 -07:00
Drew Regitsky
d3d450105e fix(contacts): move contact rank fetching to sync workers, refactor
Summary:
Fixes bug where contact ranking was not being fetched, and refactors the refreshing
of contact ranks. Moves periodic refreshing of the database-stored ranks to the sync
workers so it occurs in the background, once per account. Refactors JSON cache code
accordingly.

Test Plan: manual

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2137
2015-10-09 12:40:36 -07:00
Ben Gotow
fd69d1af9c fix(contributing): Expand the instructions for running the stack on your own
Addresses several things brought up internally and in https://github.com/nylas/N1/pull/41
2015-10-09 10:41:05 -07:00
Ben Gotow
a977aacb57 Merge pull request #52 from mbilker/fix-clean-script
Change atom to nylas in clean script
2015-10-09 10:23:28 -07:00
Evan Morikawa
fb39edd531 Merge pull request #53 from mbilker/travis-update
Travis update
2015-10-09 10:20:37 -07:00
Evan Morikawa
913b00232d Add ChaosMonkey to test misbehaving servers
Summary:
`ChaosMonkey.unleashOnAPI()` will by default cause all API requests to 500

`ChaosMonkey.unleashOnAPI(timeoutMonkey: true)` will cause all API requests
to SOCKETTIMEOUT

`ChaosMonkey.unleashOnAPI(numMonkeys: 10)` will cause the next 10 API
requests to 500

`ChaosMonkey.unleashOnAPI(errorCode: 401, numMonkeys: 10)` will cause the
next 10 API requests to 401.

It must be manually invoked from the console on each window you want the
Monkeys wrecking havok.

It is available on the `window` object as well

This was created to manually test our server failure cases.

Test Plan: manual

Reviewers: drew, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2133
2015-10-09 09:37:56 -07:00
Evan Morikawa
dfab406484 Fix contact ranking and add tests
Summary:
Contact ranking is now tested.

There was a bug whereby the RankingsJSONCache would only update in the
workerwindow. This regressed when Contact ranking moved exclusively into
the main window and separate composer windws requested rankings via ipc

Test Plan: New tests

Reviewers: drew, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2134
2015-10-09 09:31:52 -07:00
Evan Morikawa
21a4bcb3c4 Fix scrollability in expanded activity sidebar
Summary:
If your screen is narrow or you are syncing a lot of stuff, the expanded
activity sidebar had no scroll affordance

Test Plan: manual

Reviewers: drew, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2135
2015-10-09 09:31:37 -07:00
Ben Gotow
d5e04295b2 fix(initial-sync): When an error is encountered, do not start fetching from zero again
Summary:
Previously, when an error was encountered during initial mailbox sync we just started it
over after a retry delay. Recent API uptime issues mean that this was happening often and lots of
people were seeing sync retry many times. This is bad because the app is less performant while
it's syncing mail, and also generates unnecessary load as the app re-fetches threads it already has.

In this diff, there are new specs and functionality in nylas-sync-worker to start fetching
where we left off. This is typically going to be OK because the default sort ordering of the
threads endpoint is newest->oldest, so if new items have arrived since we started fetching
and page boundaries have changed, we'll get duplicate data rather than missing data. Connceting
to the streaming API as soon as we start the sync also ensures that we roll up any changes to
data we've already paginated over.

Test Plan: Run tests

Reviewers: drew, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2132
2015-10-08 19:02:54 -07:00