Commit graph

1004 commits

Author SHA1 Message Date
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 5051bdbd61 fix(tray): Order of operations causing exception 2016-02-02 12:24:59 -08:00
Ben Gotow 180294e70c 💄(tray): Use locale string so unread count uses comma notation 2016-02-02 12:18:37 -08:00
Ben Gotow 277bdc4e10 💄(composer): Account dropdown aliases styling 2016-02-02 11:33:08 -08:00
Ben Gotow fd9850b74d 💄(thread-list): Correct top border on selected threads. Fixes #1189 2016-02-02 11:12:28 -08:00
Juan Tejada 460956bc37 fix(sidebar):Correctly update sidebar by listening to FocusedPerspective
-  Clean up AccountSwitcher a bit
2016-02-02 10:59:44 -08:00
Juan Tejada bdabd1de62 Revert "fix(sidebar): Correctly update sidebar when a notif is selected"
This reverts commit 0828badb921c81a9779b2e52ab4829bf0db07410.
2016-02-02 10:58:24 -08:00
Juan Tejada 236c5ddc53 fix(sidebar): Correctly update sidebar when a notif is selected
- Clean up AccountSwitcher a bit
2016-02-02 10:44:18 -08:00
Ben Gotow 11429727f9 fix(composer): Attachment check ignores uploads. Fixes #1190 2016-02-02 10:15:20 -08:00
Juan Tejada 6a14d5b561 fix(lint): Fix new eslint rule introduced with babel-eslint upgrade.
See https://phabricator.babeljs.io/T6925
2016-02-01 20:07:36 -08: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
Ben Gotow aade6a6579 rm(Nilas-contact-elements): Remove unused package 2016-02-01 19:12:06 -08:00
Juan Tejada c67bab052a fix(prefs): Fix selector for default account for send 2016-02-01 18:34:42 -08:00
Juan Tejada 9408feb7aa fix(default-alias):Show correct list of accounts and aliases in composer 2016-02-01 18:34:42 -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
Ben Gotow 648bf1b309 fix(send-and-archive): Was disabling signatures due to name collision 2016-02-01 17:33:18 -08:00
Ben Gotow 809f51f960 feat(reorder): Re-order mail rules (#1074) and accounts (#631)
Summary:
This implements EditableList re-ordering via a new prop callback.
You can drag and drop items in the mail rules list and the accounts list.
Note that you can't drag between lists - right now this is just to enable
re-ordering.

Test Plan: No new specs yet

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2495
2016-02-01 14:06:54 -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
Juan Tejada a00adca3e5 fix(shortcuts): Add shortcut to mark as spam, fixes #765
- Minor cleanup + docs
2016-02-01 12:21:42 -08:00
Ben Gotow bf0f3828dc fix(thread-list): Remove dup accountIds to avoid extra work 2016-01-30 15:00:20 -08:00
Ben Gotow e37c95bb4d fix(send+archive): Update to use focused perspective 2016-01-29 19:01:47 -08:00
Ben Gotow c8d8bd0aee fix(thread-list): AccountId resolution for items outside loaded range 2016-01-29 17:56:57 -08:00
Evan Morikawa ec553b0c3d fix(pref): check for mounting on async launch service 2016-01-29 17:11:54 -08:00
Ben Gotow e6360cf18b feat(screenshot-mode): Minor fix to unmount method 2016-01-29 16:59:51 -08:00
Ben Gotow d61becc549 feat(screenshot-mode): Tiny feature for removing PII when taking debug screenshots 2016-01-29 16:39:07 -08:00
Ben Gotow 3c9db9bd85 fix(activity): "Long Polling" => "Delta Streaming" because we don't really poll. 2016-01-29 16:06:33 -08:00
Ben Gotow eec7c829ce fix(dropdown): Open up or down depending on position 2016-01-29 15:52:40 -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 48a64e7fef fix(focus): Don't clear when item is scrolled out of retained range 2016-01-29 12:34:58 -08:00
Juan Tejada 5c6a40ae96 fix(styles): Actually fix styles for faded recipient list 2016-01-29 11:18:28 -08:00
Juan Tejada f4f9db9310 fix(styles): Fix styles for faded recipient list 2016-01-29 11:13:25 -08:00
Juan Tejada 6c8a8bca8c fix(styles): Cleanup less files for account sidebar and switcher 2016-01-29 11:03:52 -08:00
Ben Gotow 180da72b77 fix(notifs): Categories inside Threads need accountId. Fixes #1155 2016-01-29 10:49:45 -08:00
Juan Tejada 21ebd82ece fix(sidebar): Update sidebar correctly when an account added or removed 2016-01-29 10:21:49 -08:00
Ben Gotow 183cbaff17 fix(config): observe fires immediately, causing re-renders 2016-01-29 00:31:10 -08:00
Juan Tejada be73b8bea8 fix(account-switcher): Don't display "All Accounts" when only 1 account 2016-01-28 19:53:12 -08:00
Evan Morikawa 6620779ee2 fix(message): fix truncation of messages
It would seem the document.documentElement.scrollHeight can return 0 when
the document.body.scrollHeight reliably returns the correct height.
Changed to fallback to various height checking mechanisms.

Fixes #425
Fixes #1102
Fixes #1153
2016-01-28 18:07:43 -08:00
Ben Gotow 25db6c696d fix(labels): Never show labels UX for threads split across folders 2016-01-28 16:57:24 -08:00
Ben Gotow ef5a8fc8e9 fix(important): Hide important in message column of unified unless Gmail 2016-01-28 16:57:24 -08:00
Ben Gotow ef7c98af2c fix(account-sidebar): onToggleCollapsed => onCollapseToggled 2016-01-28 16:57:24 -08:00
Juan Tejada 896c1e1fe9 fix(sidebar): Prevent editing items in OutlineView when not allowed
- Fix check in OutlineViewItem
2016-01-28 16:21:21 -08:00
Ben Gotow 0fe0542bf9 fix(unified): Add a unified icon. designer gets back tues. 2016-01-28 16:01:22 -08:00
Juan Tejada 74c72e0915 add(docs): Add docs for OutlineView and OutlineViewItem
- Renames some stuff
2016-01-28 15:28:15 -08:00
Ben Gotow e39662983d fix(important): Fix bugs in "important" label categorization 2016-01-28 15:27:03 -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
Drew Regitsky bb6f74d5f2 fix(templates): small CSS fix in preferences page 2016-01-28 14:51:31 -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
Juan Tejada 79c103ae15 fix(perspective): Update MailboxPerspective.canApplyToThreads
- Checks if the account ids of the threads that want to be applied are
  contained inside the perspectives account ids. E.g.:
  - I can move thread from account A to unified inbox or inbox A, but
    not to inbox B.
  - I can move threads from account A to a folder in account A but not a
    folder in account B
- Update data transferred in drag + other minor updates
2016-01-28 13:30:08 -08:00