2015-04-09 10:25:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
moment = require "moment"
|
|
|
|
_ = require 'underscore-plus'
|
|
|
|
CSON = require 'season'
|
|
|
|
React = require "react/addons"
|
|
|
|
ReactTestUtils = React.addons.TestUtils
|
2015-03-10 09:25:53 +08:00
|
|
|
ReactTestUtils = _.extend ReactTestUtils, require "jasmine-react-helpers"
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
|
|
|
{Thread,
|
|
|
|
Actions,
|
|
|
|
Namespace,
|
|
|
|
DatabaseStore,
|
2015-03-26 02:17:57 +08:00
|
|
|
WorkspaceStore,
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
InboxTestUtils,
|
2015-02-19 06:09:46 +08:00
|
|
|
NamespaceStore,
|
|
|
|
ComponentRegistry} = require "inbox-exports"
|
2015-03-10 09:25:53 +08:00
|
|
|
{ListTabular} = require 'ui-components'
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
2015-04-01 08:19:17 +08:00
|
|
|
|
|
|
|
ThreadStore = require "../lib/thread-store"
|
2015-03-21 08:51:49 +08:00
|
|
|
ThreadList = require "../lib/thread-list"
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
2015-02-19 06:09:46 +08:00
|
|
|
ParticipantsItem = React.createClass
|
|
|
|
render: -> <div></div>
|
|
|
|
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
me = new Namespace(
|
|
|
|
"name": "User One",
|
|
|
|
"email": "user1@inboxapp.com"
|
|
|
|
"provider": "inbox"
|
|
|
|
)
|
|
|
|
NamespaceStore._current = me
|
|
|
|
|
|
|
|
test_threads = -> [
|
|
|
|
(new Thread).fromJSON({
|
|
|
|
"id": "111",
|
|
|
|
"object": "thread",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"namespace_id": "nsid",
|
|
|
|
"snippet": "snippet 111",
|
|
|
|
"subject": "Subject 111",
|
|
|
|
"tags": [
|
|
|
|
{
|
|
|
|
"id": "unseen",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "unseen"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "all",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "all"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "inbox",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "inbox"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "unread",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "unread"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "attachment",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "attachment"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"participants": [
|
|
|
|
{
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "User One",
|
|
|
|
"email": "user1@inboxapp.com"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "User Two",
|
|
|
|
"email": "user2@inboxapp.com"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"last_message_timestamp": 1415742036
|
|
|
|
}),
|
|
|
|
(new Thread).fromJSON({
|
|
|
|
"id": "222",
|
|
|
|
"object": "thread",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"namespace_id": "nsid",
|
|
|
|
"snippet": "snippet 222",
|
|
|
|
"subject": "Subject 222",
|
|
|
|
"tags": [
|
|
|
|
{
|
|
|
|
"id": "unread",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "unread"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "all",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "all"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "unseen",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "unseen"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "inbox",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "inbox"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"participants": [
|
|
|
|
{
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "User One",
|
|
|
|
"email": "user1@inboxapp.com"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "User Three",
|
|
|
|
"email": "user3@inboxapp.com"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"last_message_timestamp": 1415741913
|
|
|
|
}),
|
|
|
|
(new Thread).fromJSON({
|
|
|
|
"id": "333",
|
|
|
|
"object": "thread",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"namespace_id": "nsid",
|
|
|
|
"snippet": "snippet 333",
|
|
|
|
"subject": "Subject 333",
|
|
|
|
"tags": [
|
|
|
|
{
|
|
|
|
"id": "inbox",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "inbox"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "all",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "all"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "unseen",
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "unseen"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"participants": [
|
|
|
|
{
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "User One",
|
|
|
|
"email": "user1@inboxapp.com"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"created_at": null,
|
|
|
|
"updated_at": null,
|
|
|
|
"name": "User Four",
|
|
|
|
"email": "user4@inboxapp.com"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"last_message_timestamp": 1415741837
|
|
|
|
})
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
cjsxSubjectResolver = (thread) ->
|
|
|
|
<div>
|
|
|
|
<span>Subject {thread.id}</span>
|
|
|
|
<span className="snippet">Snippet</span>
|
|
|
|
</div>
|
|
|
|
|
2015-03-10 09:25:53 +08:00
|
|
|
describe "ThreadList", ->
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
|
|
|
Foo = React.createClass({render: -> <div>{@props.children}</div>})
|
2015-03-10 09:25:53 +08:00
|
|
|
c1 = new ListTabular.Column
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
name: "Name"
|
|
|
|
flex: 1
|
|
|
|
resolver: (thread) -> "#{thread.id} Test Name"
|
2015-03-10 09:25:53 +08:00
|
|
|
c2 = new ListTabular.Column
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
name: "Subject"
|
|
|
|
flex: 3
|
|
|
|
resolver: cjsxSubjectResolver
|
2015-03-10 09:25:53 +08:00
|
|
|
c3 = new ListTabular.Column
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
name: "Date"
|
|
|
|
resolver: (thread) -> <Foo>{thread.id}</Foo>
|
|
|
|
|
|
|
|
columns = [c1,c2,c3]
|
|
|
|
|
|
|
|
beforeEach ->
|
2015-02-11 03:10:14 +08:00
|
|
|
InboxTestUtils.loadKeymap("internal_packages/thread-list/keymaps/thread-list.cson")
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
spyOn(ThreadStore, "_onNamespaceChanged")
|
|
|
|
spyOn(DatabaseStore, "findAll").andCallFake ->
|
|
|
|
new Promise (resolve, reject) -> resolve(test_threads())
|
2015-03-26 02:17:57 +08:00
|
|
|
spyOn(Actions, "archiveCurrentThread")
|
|
|
|
spyOn(Actions, "archiveAndNext")
|
|
|
|
spyOn(Actions, "archiveAndPrevious")
|
2015-04-07 02:46:20 +08:00
|
|
|
ReactTestUtils.spyOnClass(ThreadList, "_prepareColumns").andCallFake ->
|
|
|
|
@_columns = columns
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
|
|
|
ThreadStore._resetInstanceVars()
|
|
|
|
|
2015-02-19 06:09:46 +08:00
|
|
|
ComponentRegistry.register
|
|
|
|
name: 'Participants'
|
|
|
|
view: ParticipantsItem
|
|
|
|
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
@thread_list = ReactTestUtils.renderIntoDocument(
|
2015-03-10 09:25:53 +08:00
|
|
|
<ThreadList />
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
it "renders into the document", ->
|
|
|
|
expect(ReactTestUtils.isCompositeComponentWithType(@thread_list,
|
2015-03-10 09:25:53 +08:00
|
|
|
ThreadList)).toBe true
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
|
|
|
it "has the expected columns", ->
|
2015-03-31 02:21:23 +08:00
|
|
|
expect(@thread_list._columns).toEqual columns
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
|
|
|
it "by default has zero children", ->
|
2015-03-10 09:25:53 +08:00
|
|
|
items = ReactTestUtils.scryRenderedComponentsWithType(@thread_list, ListTabular.Item)
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
expect(items.length).toBe 0
|
|
|
|
|
2015-03-26 02:17:57 +08:00
|
|
|
describe "when the workspace is in list mode", ->
|
|
|
|
beforeEach ->
|
|
|
|
spyOn(WorkspaceStore, "selectedLayoutMode").andReturn "list"
|
2015-04-01 08:19:17 +08:00
|
|
|
@thread_list.setState focusedId: "t111"
|
2015-03-26 02:17:57 +08:00
|
|
|
|
|
|
|
it "allows reply only when the sheet type is 'Thread'", ->
|
|
|
|
spyOn(WorkspaceStore, "sheet").andCallFake -> {type: "Thread"}
|
|
|
|
spyOn(Actions, "composeReply")
|
|
|
|
@thread_list._onReply()
|
|
|
|
expect(Actions.composeReply).toHaveBeenCalled()
|
|
|
|
expect(@thread_list._actionInVisualScope()).toBe true
|
|
|
|
|
|
|
|
it "doesn't reply only when the sheet type isnt 'Thread'", ->
|
|
|
|
spyOn(WorkspaceStore, "sheet").andCallFake -> {type: "Root"}
|
|
|
|
spyOn(Actions, "composeReply")
|
|
|
|
@thread_list._onReply()
|
|
|
|
expect(Actions.composeReply).not.toHaveBeenCalled()
|
|
|
|
expect(@thread_list._actionInVisualScope()).toBe false
|
|
|
|
|
|
|
|
describe "when the workspace is in split mode", ->
|
|
|
|
beforeEach ->
|
|
|
|
spyOn(WorkspaceStore, "selectedLayoutMode").andReturn "split"
|
2015-04-01 08:19:17 +08:00
|
|
|
@thread_list.setState focusedId: "t111"
|
2015-03-26 02:17:57 +08:00
|
|
|
|
|
|
|
it "allows reply and reply-all regardless of sheet type", ->
|
|
|
|
spyOn(WorkspaceStore, "sheet").andCallFake -> {type: "anything"}
|
|
|
|
spyOn(Actions, "composeReply")
|
|
|
|
@thread_list._onReply()
|
|
|
|
expect(Actions.composeReply).toHaveBeenCalled()
|
|
|
|
expect(@thread_list._actionInVisualScope()).toBe true
|
|
|
|
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
describe "Populated thread list", ->
|
|
|
|
beforeEach ->
|
2015-04-07 02:46:20 +08:00
|
|
|
view =
|
|
|
|
loaded: -> true
|
|
|
|
get: (i) -> test_threads()[i]
|
|
|
|
count: -> test_threads().length
|
|
|
|
setRetainedRange: ->
|
|
|
|
ThreadStore._view = view
|
2015-04-01 08:19:17 +08:00
|
|
|
ThreadStore._focusedId = null
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
ThreadStore.trigger(ThreadStore)
|
|
|
|
@thread_list_node = @thread_list.getDOMNode()
|
2015-04-01 07:32:14 +08:00
|
|
|
spyOn(@thread_list, "setState").andCallThrough()
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
|
|
|
it "renders all of the thread list items", ->
|
2015-04-01 07:32:14 +08:00
|
|
|
advanceClock(100)
|
2015-03-10 09:25:53 +08:00
|
|
|
items = ReactTestUtils.scryRenderedComponentsWithType(@thread_list, ListTabular.Item)
|
2015-04-07 02:46:20 +08:00
|
|
|
expect(items.length).toBe(test_threads().length)
|
fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:
1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
- View thread with draft, edit draft
- Move to another thread
- Move back to thread with draft
- Move to another thread. Notice that one or more messages from thread with draft are still there.
There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.
2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:
- In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.
- Previously, when you added a contact to To/CC/BCC, this happened:
<input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates
Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.
To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!
This diff includes a few minor fixes as well:
1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React
Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1125
2015-02-04 08:24:31 +08:00
|
|
|
|
|
|
|
|
2015-03-10 09:25:53 +08:00
|
|
|
# describe "ThreadListNarrow", ->
|
|
|
|
|
|
|
|
# beforeEach ->
|
|
|
|
# InboxTestUtils.loadKeymap("internal_packages/thread-list/keymaps/thread-list.cson")
|
|
|
|
# spyOn(ThreadStore, "_onNamespaceChanged")
|
|
|
|
# spyOn(DatabaseStore, "findAll").andCallFake ->
|
|
|
|
# new Promise (resolve, reject) -> resolve(test_threads())
|
|
|
|
# ThreadStore._resetInstanceVars()
|
|
|
|
|
|
|
|
# ComponentRegistry.register
|
|
|
|
# name: 'Participants'
|
|
|
|
# view: ParticipantsItem
|
|
|
|
|
|
|
|
# @thread_list = ReactTestUtils.renderIntoDocument(
|
|
|
|
# <ThreadListNarrow />
|
|
|
|
# )
|
|
|
|
|
|
|
|
# it "renders into the document", ->
|
|
|
|
# expect(ReactTestUtils.isCompositeComponentWithType(@thread_list,
|
|
|
|
# ThreadListNarrow)).toBe true
|
|
|
|
|
|
|
|
# it "by default has zero children", ->
|
|
|
|
# items = ReactTestUtils.scryRenderedComponentsWithType(@thread_list,
|
|
|
|
# ThreadListNarrowItem)
|
|
|
|
# expect(items.length).toBe 0
|
|
|
|
|
|
|
|
# describe "Populated thread list", ->
|
|
|
|
# beforeEach ->
|
|
|
|
# ThreadStore._items = test_threads()
|
2015-04-01 08:19:17 +08:00
|
|
|
# ThreadStore._focusedId = null
|
2015-03-10 09:25:53 +08:00
|
|
|
# ThreadStore.trigger()
|
|
|
|
# @thread_list_node = @thread_list.getDOMNode()
|
|
|
|
|
|
|
|
# it "renders all of the thread list items", ->
|
|
|
|
# items = ReactTestUtils.scryRenderedComponentsWithType(@thread_list,
|
|
|
|
# ThreadListNarrowItem)
|
|
|
|
# expect(items.length).toBe 3
|
|
|
|
|
|
|
|
# describe "Shifting selected index", ->
|
|
|
|
|
|
|
|
# beforeEach ->
|
|
|
|
# spyOn(@thread_list, "_onShiftSelectedIndex")
|
|
|
|
# spyOn(Actions, "selectThreadId")
|
|
|
|
|
|
|
|
# it "can move selection up", ->
|
2015-04-09 10:25:00 +08:00
|
|
|
# atom.commands.dispatch(document.body, "core:previous-item")
|
2015-03-10 09:25:53 +08:00
|
|
|
# expect(@thread_list._onShiftSelectedIndex).toHaveBeenCalledWith(-1)
|
|
|
|
|
|
|
|
# it "can move selection down", ->
|
2015-04-09 10:25:00 +08:00
|
|
|
# atom.commands.dispatch(document.body, "core:next-item")
|
2015-03-10 09:25:53 +08:00
|
|
|
# expect(@thread_list._onShiftSelectedIndex).toHaveBeenCalledWith(1)
|
|
|
|
|
|
|
|
# describe "Triggering message list commands", ->
|
|
|
|
# beforeEach ->
|
|
|
|
# spyOn(Actions, "composeReply")
|
|
|
|
# spyOn(Actions, "composeReplyAll")
|
|
|
|
# spyOn(Actions, "composeForward")
|
|
|
|
# ThreadStore._onSelectThreadId("111")
|
|
|
|
# @thread = ThreadStore.selectedThread()
|
|
|
|
# spyOn(@thread, "archive")
|
|
|
|
# spyOn(@thread_list, "_onShiftSelectedIndex")
|
|
|
|
# spyOn(Actions, "selectThreadId")
|
|
|
|
|
|
|
|
# it "can reply to the currently selected thread", ->
|
|
|
|
# atom.commands.dispatch(document.body, "application:reply")
|
|
|
|
# expect(Actions.composeReply).toHaveBeenCalledWith(threadId: @thread.id)
|
|
|
|
|
|
|
|
# it "can reply all to the currently selected thread", ->
|
|
|
|
# atom.commands.dispatch(document.body, "application:reply-all")
|
|
|
|
# expect(Actions.composeReplyAll).toHaveBeenCalledWith(threadId: @thread.id)
|
|
|
|
|
|
|
|
# it "can forward the currently selected thread", ->
|
|
|
|
# atom.commands.dispatch(document.body, "application:forward")
|
|
|
|
# expect(Actions.composeForward).toHaveBeenCalledWith(threadId: @thread.id)
|
|
|
|
|
|
|
|
# it "can archive the currently selected thread", ->
|
|
|
|
# atom.commands.dispatch(document.body, "application:remove-item")
|
|
|
|
# expect(@thread.archive).toHaveBeenCalled()
|
|
|
|
|
|
|
|
# it "can archive the currently selected thread and navigate up", ->
|
|
|
|
# atom.commands.dispatch(document.body, "application:remove-and-previous")
|
|
|
|
# expect(@thread.archive).toHaveBeenCalled()
|
|
|
|
# expect(@thread_list._onShiftSelectedIndex).toHaveBeenCalledWith(-1)
|
|
|
|
|
|
|
|
# it "does nothing when no thread is selected", ->
|
2015-04-01 08:19:17 +08:00
|
|
|
# ThreadStore._focusedId = null
|
2015-03-10 09:25:53 +08:00
|
|
|
# atom.commands.dispatch(document.body, "application:reply")
|
|
|
|
# expect(Actions.composeReply.calls.length).toEqual(0)
|
|
|
|
|
|
|
|
# describe "ThreadListNarrowItem", ->
|
|
|
|
# beforeEach ->
|
|
|
|
# items = ReactTestUtils.scryRenderedComponentsWithType(@thread_list,
|
|
|
|
# ThreadListNarrowItem)
|
|
|
|
# item = items.filter (tli) -> tli.props.thread.id is "111"
|
|
|
|
# @thread_list_item = item[0]
|
|
|
|
# @thread_date = moment(@thread_list_item.props.thread.lastMessageTimestamp)
|
|
|
|
|
|
|
|
# it "finds the thread list item by id", ->
|
|
|
|
# expect(@thread_list_item.props.thread.id).toBe "111"
|
|
|
|
|
|
|
|
# it "fires the appropriate Action on click", ->
|
|
|
|
# spyOn(Actions, "selectThreadId")
|
|
|
|
# ReactTestUtils.Simulate.click @thread_list_item.getDOMNode()
|
2015-04-01 08:19:17 +08:00
|
|
|
# expect(Actions.focusThreadId).toHaveBeenCalledWith("111")
|
2015-03-10 09:25:53 +08:00
|
|
|
|
|
|
|
# it "sets the selected state on the thread item", ->
|
|
|
|
# ThreadStore._onSelectThreadId("111")
|
|
|
|
# items = ReactTestUtils.scryRenderedDOMComponentsWithClass(@thread_list, "selected")
|
|
|
|
# expect(items.length).toBe 1
|
|
|
|
# expect(items[0].props.id).toBe "111"
|
|
|
|
|
|
|
|
# it "renders de-selection when invalid id is emitted", ->
|
|
|
|
# ThreadStore._onSelectThreadId('abc')
|
|
|
|
# items = ReactTestUtils.scryRenderedDOMComponentsWithClass(@thread_list, "selected")
|
|
|
|
# expect(items.length).toBe 0
|
|
|
|
|
|
|
|
# # test "last_message_timestamp": 1415742036
|
|
|
|
# it "displays the time from threads LONG ago", ->
|
|
|
|
# spyOn(@thread_list_item, "_today").andCallFake =>
|
|
|
|
# @thread_date.add(2, 'years')
|
|
|
|
# expect(@thread_list_item._timeFormat()).toBe "MMM D YYYY"
|
|
|
|
|
|
|
|
# it "displays the time from threads a bit ago", ->
|
|
|
|
# spyOn(@thread_list_item, "_today").andCallFake =>
|
|
|
|
# @thread_date.add(2, 'days')
|
|
|
|
# expect(@thread_list_item._timeFormat()).toBe "MMM D"
|
|
|
|
|
|
|
|
# it "displays the time from threads exactly a day ago", ->
|
|
|
|
# spyOn(@thread_list_item, "_today").andCallFake =>
|
|
|
|
# @thread_date.add(1, 'day')
|
|
|
|
# expect(@thread_list_item._timeFormat()).toBe "h:mm a"
|
|
|
|
|
|
|
|
# it "displays the time from threads recently", ->
|
|
|
|
# spyOn(@thread_list_item, "_today").andCallFake =>
|
|
|
|
# @thread_date.add(2, 'hours')
|
|
|
|
# expect(@thread_list_item._timeFormat()).toBe "h:mm a"
|