Commit graph

833 commits

Author SHA1 Message Date
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 067a12dc17 fix(extensions):Fix extension method calls that weren't passing args hash 2015-12-30 19:05:27 -05:00
Evan Morikawa 116d375ff7 feat(extension): async extensions
Summary:
WIP:

This is a quick patch for Drew to make extensions async

We'll need to think through the upgrade/deprecation plan to roll out async
extensions across all of our APIs.

Test Plan: TODO

Reviewers: drew, evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2392
2015-12-30 18:04:52 -05:00
Juan Tejada e9896039aa fix(contenteditable): Fix nested list behavior:
Summary:
- Fixes #862
- Makes it behave like hackpad -- adding nested lists will indent the
  current list item
- Fix lint errors

Test Plan: - Integration tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2402
2015-12-30 15:21:05 -05:00
Juan Tejada 27cc46ed1f feat(column-width): Store column width state in the app
Summary:
- Fixes #833
- Allows column widths to be persisted between sessions

Test Plan: - Manual

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2401
2015-12-30 15:18:38 -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
Drew Regitsky 2e1056f49e refactor(templates): major additions and refactoring for the Templates plugin.
Summary:
Adds several new features to the templates plugin, fixes some existing bugs, and
refactors existing code.

New Plugin Features/Fixes:
- Changes the templates editor in preferences to allow variables to be entered with
 `{{brackets}}`. Handles many contenteditable complexities to implement.
- Better interaction for renaming and deleting of templates in the editor.
- Changes tabbing behavior when using templates. Tabbing between variables now wraps
  around, and typing tab from outside a variable region highlights the closest region.
- Prevents "Enter" key in the composer when inside a variable region, and strips all
  formatting/tags from within the region - this prevents major contenteditable issues
  that can result in inline CSS in the style of our variable regions, which will not be
  removed when sending.
- Shows a warning when choosing a template if it will replace existing text in a draft.
- Prevents invalid characters in template names (due to filenames, esp. on Windows),
  and shows an error message. Strips these characters from draft titles when making a
  template.
- Fixes a bug where TemplateStore's initialization code was being called multiple times.

New N1 code:
- Several new methods in `DOMUtils` useful for working with contenteditable.
- Implement some missing methods in `Editor`

Refactor:
- Major refactor/rewrite of template composer extension to use new DOMUtils methods
  and simplify the logic (while adding new functionality).

Remaining issues:
- `preferences-tempaltes.cjsx` and `template-editor.coffee` should be rewritten in ES6
  for consistency
- Need tests for new DOMUtils functions and for new Templates plugin code.

Test Plan: manual, need to update specs

Reviewers: evan, bengotow

Reviewed By: evan, bengotow

Subscribers: juan

Differential Revision: https://phab.nylas.com/D2382
2015-12-29 15:11:04 -08:00
Drew Regitsky 1b5d660eaf fix(contenteditable): revert 36b4f3, call onClick in mouse-service 2015-12-29 14:57:07 -08:00
Drew Regitsky 36b4f3f456 fix(contenteditable): hook up onClick handler for extensions
Summary: Add missing code to make onClick work in contenteditable extensions.

Test Plan: manual

Reviewers: juan, evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2395
2015-12-29 14:41:00 -08:00
Ben Gotow 30c5e20e88 fix(mail-rules): Bail if a message is missing a thread 2015-12-29 14:21:42 -08:00
Ben Gotow 5e777fe1f4 fix(uploads): Cancel uploads when offline (#365), mark for refactor 2015-12-29 14:21:42 -08: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
Drew Regitsky 8dc3e009d4 fix(contenteditable): add default prop for onSelectionChanged 2015-12-28 17:34:18 -08:00
Ben Gotow bb268d3be6 fix(regex): Allow ', !, ?, ^, {, }, | in email addresses (Fixes #754) 2015-12-28 14:35:47 -08:00
Ben Gotow 8e54ff8069 fix(markAsRead): Option to mark read manually only (Fixes #804) 2015-12-28 14:23:34 -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
Evan Morikawa a9be427c42 fix(tab): fix import error 2015-12-23 15:48:41 -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 99560a35cf fix(observables): Fix QuerySubscription to check for clientId's in result set
- See TODO comments
- Fixes #680
- Fixes #681
2015-12-22 13:42:25 -08:00
Evan Morikawa 3dbdd5cfd6 fix(spec): fix send-draft spec to test for include 2015-12-22 10:36:25 -08:00
Juan Tejada 2145627547 fix(send-draft): Include body when sending message in new send draft
logic
2015-12-22 10:06:58 -08:00
Juan Tejada 5675f24407 fix(prefs): Prevent main key commands from being fired to thread list while on prefs page
Summary:
- When the preferences sheet is open, any commands triggered through key presses were being received by the thread-list, producing unexpected
(and unseen) results
- This is a partial/temporary solution and should go away when we do the Keymap/Commands/Menu refactor

Test Plan: - Manaul

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2380
2015-12-22 09:38:56 -08:00
Juan Tejada a22dbd045f 🍒(atom): Pull updated version of Command Registry:
- This fixes a bug present in the earlier version where stopPropagation and
preventDefault were not correctly defined in the custom event
- Updates clear-cut dependency and initialization of CommandRegistry in
NylasEnv
2015-12-21 20:31:54 -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 de1f8d24d0 update(tray): Show 'Open Inbox' tray menu option and option to disable
tray  on Mac and Linux

- Resolves #673
- Resolves #762
- Resolves #594
2015-12-20 21:32:59 -08:00
Juan Tejada 504d052227 fix(feedback-window): Close correctly when in fullscreen mode
- Now shows main window when feedback window is closed/hidden
- Fixes #615
2015-12-20 13:11:58 -08:00
Juan Tejada 0b841dc5a8 fix(typo): Fix typo in floating toolbar container 2015-12-18 14:10:53 -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
Ben Gotow eb21377f5f fix(downloads): Create directory path with correct separator
Fixes #709
2015-12-15 13:55:59 -08:00
Juan Tejada f575a2dabc feat(theme-selector): Add theme selector to preferences page
Summary:
- Adds a couple of helper methods to theme manager and updates how
a theme package is enabled to be consistent with how we actually want to
activate themes.
- Adds small select component to choose a theme or install a new one.

Test Plan: - Manual

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2355
2015-12-15 10:29:58 -08:00
Ben Gotow 64fc74cc6a fix(lint): Remove return statement from editable list 2015-12-14 15:47:58 -08:00
Juan Tejada 6c7a162909 add(integration-test): Adds test for onboarding flow with Exchange
Summary:
- Make sure user can log in using exchange
- Adds some test helpers for the test
- Updates eslint.json and cleans up lint errors

Test Plan: - Integration Tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2346
2015-12-14 15:14:58 -08:00
Juan Tejada 26a907c0c0 feat(default-alias): Add functionality to select a default alias
Summary:
- Update Account model witha default alias and DraftStore methods that
construct new messages to use default alias if available.
- Update AccountDetails page and add selector to select default alias

Test Plan: - Unit tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2352
2015-12-14 14:35:26 -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
Evan Morikawa 54f52a61d0 fix(tests): fix composer integration tests 2015-12-14 12:05:55 -08:00
Juan Tejada f153d4befc fix(prefs): Make General preferences tab be the initially selected one 2015-12-14 00:31:11 -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
Ben Gotow f0e4b2405f fix(select-all): Disable Cmd-A to select threads for now 2015-12-11 14:10:04 -08:00
Evan Morikawa e83c16ec21 fix(spellcheck): let win < 8 fallback to hunspell 2015-12-11 16:41:41 -05:00
Juan Tejada e8fb26ab88 fix(editable-list): Refocus list after editing or creating 2015-12-11 12:43:01 -08:00
Evan Morikawa ed805869f2 fix(spellcheck): add tests and merge in Linux changes 2015-12-11 15:36:13 -05:00