Commit graph

84 commits

Author SHA1 Message Date
Evan Morikawa 05b50fd7bf fix(build): bail if script/bootstrap fails and enhance test output
Have the test output
2015-11-23 14:34:18 -05:00
Juan Tejada c2ce51ae0c fix(composer): Fix several composer issues and refactor Contenteditable
Summary:
  - Fixes T5819 issues
  - Adds ContenteditbalePlugin mechanism to allow extension of Contenteditable
    functionality, and completely removes lifecycleCallbacks from Contenteditable
  - Refactors list functionality outside of Contenteditable and into a plugin
  - Updates ComposerView to apply DraftStoreExtensions through a ContentEditablePlugin
  - Moves spell checking logic outside of Contenteditable into the spellcheck package

Fixes T5824 (atom.assert)
Fixes T5951 (shift-tabbing) bullets

Test Plan: - Unit tests and manual

Reviewers: evan, bengotow

Reviewed By: bengotow

Maniphest Tasks: T5951, T5824, T5819

Differential Revision: https://phab.nylas.com/D2261
2015-11-18 15:22:31 -08:00
Evan Morikawa 43c4859592 fix(draft): fix showing of incorrect body when pending send
Summary: Fixes T3712

Test Plan: new tests

Reviewers: juan, bengotow

Reviewed By: bengotow

Maniphest Tasks: T3712

Differential Revision: https://phab.nylas.com/D2273
2015-11-18 12:32:07 -08:00
Ben Gotow a5256bd56a 🍒(atom): Pull new, cleaner compile cache + index.js 2015-11-17 19:43:08 -08:00
Ben Gotow 285a60493e fix(specs): Ternary operator in jasmine-helper was valid coffee... 2015-11-17 17:48:32 -08:00
Ben Gotow a5013c0bbd fix(specs): Update specs following 0.29.2 > 0.34.3 move 2015-11-17 17:40:06 -08:00
Evan Morikawa 51602f69a5 refactor(env): new NylasEnv global
Converted all references of global atom to NylasEnv

Temporary rename atom.io

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.io/temporaryAtomIoReplacement/g'

atom.config to NylasEnv.config

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.config/NylasEnv.config/g'

atom.packages -> NylasEnv.packages

atom.commands -> NylasEnv.commands atom.getLoadSettings

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.commands/NylasEnv.commands/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getLoadSettings/NylasEnv.getLoadSettings/g'

More common atom methods

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.styles/NylasEnv.styles/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.emitError/NylasEnv.emitError/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.inSpecMode/NylasEnv.inSpecMode/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.inDevMode/NylasEnv.inDevMode/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getWindowType/NylasEnv.getWindowType/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.displayWindow/NylasEnv.displayWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.quit/NylasEnv.quit/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.close/NylasEnv.close/g'

More atom method changes

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.keymaps/NylasEnv.keymaps/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.hide/NylasEnv.hide/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getCurrentWindow/NylasEnv.getCurrentWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.menu/NylasEnv.menu/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getConfigDirPath/NylasEnv.getConfigDirPath/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.isMainWindow/NylasEnv.isMainWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.finishUnload/NylasEnv.finishUnload/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.isWorkWindow/NylasEnv.isWorkWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.showSaveDialog/NylasEnv.showSaveDialog/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.append/NylasEnv.append/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.confirm/NylasEnv.confirm/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.clipboard/NylasEnv.clipboard/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getVersion/NylasEnv.getVersion/g'

More atom renaming

Rename atom methods

More atom methods

Fix grunt config variable

Change atom.cmd to N1.cmd

Rename atom.coffee and atom.js to nylas-env.coffee nylas-env.js

Fix atom global reference in specs manually

Fix atom requires

Change engine from atom to nylas

got rid of global/nylas-env

rename to nylas-win-bootup

Fix onWindowPropsChanged to onWindowPropsReceived

fix nylas-workspace

atom-text-editor to nylas-theme-wrap

atom-text-editor -> nylas-theme-wrap

Replacing atom keyword

AtomWindow -> NylasWindow

Replace Atom -> N1

Rename atom items

nylas.asar -> atom.asar

Remove more atom references

Remove 6to5 references

Remove license exception for atom
2015-11-17 16:41:20 -08:00
Ben Gotow 74252d58d9 bump(️): Electron 0.29.2 > 0.34.3, Sqlite 3.0.11 > 3.1.1 2015-11-17 15:36:32 -08:00
Juan Tejada 647aed5f14 Convert Composer Template example to ES6
Summary:
- Include ES6 files in spec-suite
- Fix template store specs
- Refactors TemplateStore a little bit to adjust to specs
- Convert coffe .cjsx files to ES6 .jsx files
- Fix TemplateDraftStoreExtension functions
- Update ComposerTemplates example README

Test Plan: - Plugin unit tests

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2250
2015-11-14 22:12:06 -08:00
Ben Gotow 41e3b01240 fix(names): "Olivia" should not be caught by name cleanup
This fixes #393.

The name "Olivia" was being caught in our parser designed to shorten "Mike Kaylor via LinkedIn" to "Mike Kaylor". We now check that "via" is it's own distinct word in the phrase.
2015-11-13 11:42:37 -08:00
Ben Gotow fb9ffe7fa0 fix(mailto): Handle mailto links with newline characters #397
Regex was clipping off the body after the first newline. Fixes #397
2015-11-13 10:58:42 -08:00
Ben Gotow 0ab065aab3 fix(specs): Remove loading cover in spec window 2015-11-09 20:53:17 -08:00
Evan Morikawa 119da453e1 feat(selection): add selection of read, unread, starred, etc
Summary:
Can select all, deselect-all, read, unread, starred, unstarred.

Yes, it's not REALLY select "all", but it uses the items in the current
`retainedRange`. This is actually similar to what gmail does (only selects
on the first page of a 100).

Test Plan: new test

Reviewers: juan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2241
2015-11-09 10:03:55 -05:00
Evan Morikawa 37e3fe0f45 feat(keymap): add new <KeymapHandlers />
Summary:
Refactor keymaps to wrap components with a <KeymapHandlers /> component.
This more Reactful way of declaring keyback handlers prevents us from
needing to subscribe to `atom.commands`

Test Plan: new tests

Reviewers: bengotow, juan

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2226
2015-11-06 11:47:06 -08:00
Ben Gotow 0b84942051 perf(db): Lazily deserialize models on the other side of the action bridge
Summary:
We send database `trigger()` events through the ActionBrige to all windows of the app. This means that during initial sync, we're serializing, IPCing and unserializing thousands of models a minute x "N" windows.

This diff converts the payload of the trigger method into an actual class that implements a custom toJSON. It converts the impacted `objects` into a string, and doesn't deserialize them until it's asked.

Bottom line: this means that in many scenarios, we can avoid creating Contact models, etc. in composer windows only to broadcast them and then gc them.

Test Plan: No new tests yet, but this should definitel be tested. #willfix.

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2236
2015-11-06 11:15:20 -08:00
Ben Gotow 496ec58e99 perf(fromJSON): 40% perf increase by fixing "forin not optimized case"
https://github.com/petkaantonov/bluebird/wiki/Optimization-killers
2015-11-05 20:16:06 -08:00
Ben Gotow 9a41f04615 fix(specs): Don't check for updates during spec runs 2015-11-02 11:56:11 -08:00
Evan Morikawa eea25a307d fix(composer): support Chinese & others - handle composition events
Summary:
ignores composition event commands until they're done. We then simply
update the new state after that happens.

Some additional refactoring:

- The <Contenteditable /> prop is 'value' instead of 'html' to make it
  look more like a standard React controlled input
- Removed `filters` prop and `footerElements` prop from Contenteditable.
  These could easily be moved into the composer (where they belong).
- Moved contenteditable and a few of its helper classes into their own
  folder.
- Moved `UndoManager` up out of the `flux` folder into `src`. Currently
  undo/redo is only in the composer when all contenteditables should have
  the basic funcionality. Will refactor this later.
- Fix tests

Test Plan: manual

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2211
2015-10-30 20:03:33 -04:00
Ben Gotow 6170b34533 perf(message-store): Debounce reload of the message column—#249 2015-10-29 20:20:49 -07:00
Evan Morikawa cc61aa7811 feat(signatures): add signature support in preferences
Summary:
Adding signature support in preferences

Extracting out DraftStore extensions from the Contenteditable component

Moved Contenteditable to the nylas component kit

Build react remote window selection synchronization.

Test Plan: todo

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2204
2015-10-29 17:20:41 -04:00
Evan Morikawa 78f6829c1b doc(task): make methods public and add documentation 2015-10-29 15:11:01 -04:00
Evan Morikawa d0212c3dd9 fix(drafts): only syncback every 30 seconds instead of 5 seconds
This will help prevent API errors from causing multiple drafts to appear
2015-10-28 19:51:46 -04:00
Evan Morikawa ede7eda3c4 fix(unread): can mark message as unread in split mode
Summary: Fixes T4835

Test Plan: new tests

Reviewers: bengotow

Reviewed By: bengotow

Maniphest Tasks: T4835

Differential Revision: https://phab.nylas.com/D2205
2015-10-28 17:50:07 -04:00
Evan Morikawa ad5274049d fix(databse): fix memory leak on DatabaseStore.atomically
Summary:
The Promise chain we were creating was never cleared and created a memory
leak. We instead use a `PromiseQueue` to cleanup finished promises.

Also added several more tests and verified that the memory leak is gone
with the Chrome profiler

Test Plan: new tests

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2184
2015-10-22 14:19:39 -07:00
Evan Morikawa e9acc3d315 fix(event): remove EventStore
Summary:
The EventStore was really doing nothing, except caching hundreds of MB of
event data unnecessarily in each and every window :(

Test Plan: manual

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2187
2015-10-22 14:14:58 -07:00
Evan Morikawa ada6e5a2f6 fix(spec): fix contact store spec
Since it's not Promise-based anymore. It was just the spec that relied on
this.
2015-10-22 14:13:51 -07:00
Ben Gotow fddac45687 rm(metadata): MetadataStore is not in use, should be rebuilt
Resolves a request that happens whenver the user starts the app, reported in #108
2015-10-21 14:30:33 -07:00
Ben Gotow 2f28b0ad02 fix(uploads): Display error when uploading >25MB files
Fixes GitHub issue #102
2015-10-21 12:29:07 -07:00
Ben Gotow 4810775924 fix(tasks): SyncbackCategory does not need organizationUnit 2015-10-21 11:07:08 -07:00
Ben Gotow 98a2464e0f fix(specs): Unbreak tests for CategoryPicker 2015-10-21 10:57:42 -07:00
Ben Gotow 4f34c8403f 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
Evan Morikawa 531118ac5c 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
Evan Morikawa 78a3218c26 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
Evan Morikawa b0b0c14d03 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 7ebb27cdfa fix(contacts): Emails only valid if the entire string is the email. (Sentry 2991) 2015-10-09 14:30:08 -07:00
Ben Gotow 83f9f0e4ff fix(specs): ContactStore spec fixes for new contact ranking support 2015-10-09 13:42:24 -07:00
Evan Morikawa a7aec14ca3 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
Ben Gotow 5a2ddb67d5 fix(auth): Resize the auth window after an update to the token status 2015-10-06 17:58:07 -07:00
Ben Gotow 3896473e3b fix(attachments): When downloads fail, don't resolve to chained actions
Summary: Fixes Sentry 3319 and 3303

Test Plan: Run three new tests

Reviewers: dillon, evan

Reviewed By: dillon, evan

Differential Revision: https://phab.nylas.com/D2118
2015-10-05 17:57:24 -07:00
Ben Gotow b38ca54b45 fix(specs): Clean up spec failures due to hot fixes prior to launch 2015-10-05 16:45:30 -07:00
dillon 98e2f5a8c6 fix(NUX): set smaller default window size for users with large monitors
Summary:
fixes T4080

set the maximum default viewport size to 1440x900, the screen resolution for a 15 inch macbook pro.

if the monitor is either wider or taller than the default, then cap the dimension and center it.

Test Plan: added tests

Reviewers: evan, bengotow

Reviewed By: evan, bengotow

Maniphest Tasks: T4080

Differential Revision: https://phab.nylas.com/D2115
2015-10-05 16:24:17 -07:00
Ben Gotow 308c70f53d fix(sync): Request all labels / folders to avoid paging and missing inbox 2015-10-03 23:53:59 -07:00
Ben Gotow db1eae5943 fix(updater): Send UUID and email accounts to enable more specific update distribution 2015-10-03 14:45:39 -07:00
Evan Morikawa 3d20e272ee fix(specs): specs run clean 2015-10-02 18:44:12 -07:00
Evan Morikawa 39266026d1 fix(sounds): make sounds listen to config options
Summary: Fixes T3887

Test Plan: new specs

Reviewers: bengotow

Reviewed By: bengotow

Projects: #edgehill

Maniphest Tasks: T3887

Differential Revision: https://phab.nylas.com/D2104
2015-10-02 17:04:15 -07:00
Evan Morikawa 009f07dd2a refactor(dir): move exports to src/global and consolidate tests
Summary:
This:

1. Moves spec-nylas into spec
1. Gets rid of old & irrelevant specs
1. Moves the `vendor` folder (jasmine libs) into the `spec` folder
1. Moves the `exports` folder to `src/global` and updates all references

I pretty extensively made sure the client still works and that all of the
tests pass. The changes should have no effect.

Test Plan: All tests pass!

Reviewers: bengotow, dillon

Differential Revision: https://phab.nylas.com/D2098
2015-10-02 09:19:37 -07:00
Evan Morikawa 137e09eb51 refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
Evan Morikawa 8872a02405 refactor(exports): move exports to src/global 2015-10-01 21:23:37 -07:00
Ben Gotow 1d9a34f5ea rename(Nylas Mail): Replace Nylas Mail > N1 2015-09-29 09:44:30 -07:00
Ben Gotow 899ce2a27a fix(window-serialization): Restore window size, remove cruft from atom.coffee
Summary: Simplify the default window size, restore window size when the main window is loaded, fix serialization of packages in beforeunload.

Test Plan: Run tests

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2061
2015-09-24 10:40:38 -07:00