Mailspring/internal_packages/message-list/lib/message-list.cjsx

424 lines
13 KiB
Text
Raw Normal View History

_ = require 'underscore'
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
React = require 'react'
ReactDOM = require 'react-dom'
classNames = require 'classnames'
FindInThread = require('./find-in-thread').default
MessageItemContainer = require './message-item-container'
{Utils,
Actions,
Message,
DraftStore,
MessageStore,
AccountStore,
DatabaseStore,
WorkspaceStore,
ChangeLabelsTask,
ComponentRegistry,
ChangeStarredTask,
SearchableComponentStore
SearchableComponentMaker} = require("nylas-exports")
{Spinner,
RetinaImg,
MailLabelSet,
ScrollRegion,
MailImportantIcon,
InjectedComponent,
KeyCommandsRegion,
InjectedComponentSet} = require('nylas-component-kit')
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
class MessageListScrollTooltip extends React.Component
@displayName: 'MessageListScrollTooltip'
@propTypes:
viewportCenter: React.PropTypes.number.isRequired
totalHeight: React.PropTypes.number.isRequired
componentWillMount: =>
@setupForProps(@props)
componentWillReceiveProps: (newProps) =>
@setupForProps(newProps)
shouldComponentUpdate: (newProps, newState) =>
not _.isEqual(@state,newState)
setupForProps: (props) ->
# Technically, we could have MessageList provide the currently visible
# item index, but the DOM approach is simple and self-contained.
#
els = document.querySelectorAll('.message-item-wrap')
idx = _.findIndex els, (el) -> el.offsetTop > props.viewportCenter
if idx is -1
idx = els.length
@setState
idx: idx
count: els.length
render: ->
<div className="scroll-tooltip">
{@state.idx} of {@state.count}
</div>
class MessageList extends React.Component
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry Summary: This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role, it's now just location and role, and you can register components for one or more location and one or more roles without assigning the entries in the registry separate names. When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring that you can't unregister someone else's component. InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents render/component lifecycle problems from propogating. Existing components have been updated: 1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth 2. displayName is now required to use the CR. 3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent. This is useful because it's slightly faster and keeps DOM flat. This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet. Change ComponentRegistry syntax, lots more work on safely wrapping items. See description. Fix for inline flexbox scenarios (message actions) Allow ~/.inbox/packages to be symlinked to a github repo Test Plan: Run tests! Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
@displayName: 'MessageList'
@containerRequired: false
@containerStyles:
minWidth: 500
maxWidth: 999999
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
constructor: (@props) ->
@state = @_getStateFromStores()
@state.minified = true
@_draftScrollInProgress = false
@MINIFY_THRESHOLD = 3
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
componentDidMount: =>
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
@_unsubscribers = []
@_unsubscribers.push MessageStore.listen @_onChange
@_unsubscribers.push Actions.focusDraft.listen ({draftClientId}) =>
fix(focus): Remove focusedField in favor of imperative focus, break apart ComposerView Summary: - Removes controlled focus in the composer! - No React components ever perfom focus in lifecycle methods. Never again. - A new `Utils.schedule({action, after, timeout})` helper makes it easy to say "setState or load draft, etc. and then focus" - The DraftStore issues a focusDraft action after creating a draft, which causes the MessageList to focus and scroll to the desired composer, which itself decides which field to focus. - The MessageList never focuses anything automatically. - Refactors ComposerView apart — ComposerHeader handles all top fields, DraftSessionContainer handles draft session initialization and exposes props to ComposerView - ComposerHeader now uses a KeyCommandRegion (with focusIn and focusOut) to do the expanding and collapsing of the participants fields. May rename that container very soon. - Removes all CommandRegistry handling of tab and shift-tab. Unless you preventDefault, the browser does it's thing. - Removes all tabIndexes greater than 1. This is an anti-pattern—assigning everything a tabIndex of 0 tells the browser to move between them based on their order in the DOM, and is almost always what you want. - Adds "TabGroupRegion" which allows you to create a tab/shift-tabbing group, (so tabbing does not leave the active composer). Can't believe this isn't a browser feature. Todos: - Occasionally, clicking out of the composer contenteditable requires two clicks. This is because atomicEdit is restoring selection within the contenteditable and breaking blur. - Because the ComposerView does not render until it has a draft, we're back to it being white in popout composers for a brief moment. We will fix this another way - all the "return unless draft" statements were untenable. - Clicking a row in the thread list no longer shifts focus to the message list and focuses the last draft. This will be restored soon. Test Plan: Broken Reviewers: juan, evan Reviewed By: juan, evan Differential Revision: https://phab.nylas.com/D2814
2016-04-05 06:22:01 +08:00
Utils.waitFor( => @_getMessageContainer(draftClientId)?).then =>
@_focusDraft(@_getMessageContainer(draftClientId))
.catch =>
componentWillUnmount: =>
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
unsubscribe() for unsubscribe in @_unsubscribers
shouldComponentUpdate: (nextProps, nextState) =>
not Utils.isEqualReact(nextProps, @props) or
not Utils.isEqualReact(nextState, @state)
componentDidUpdate: (prevProps, prevState) =>
_globalMenuItems: ->
toggleExpandedLabel = if @state.hasCollapsedItems then "Expand" else "Collapse"
[
{
"label": "Thread",
"submenu": [{
"label": "#{toggleExpandedLabel} conversation",
"command": "message-list:toggle-expanded",
"position": "endof=view-actions",
}]
}
]
_globalKeymapHandlers: ->
handlers =
'core:reply': =>
Actions.composeReply({
thread: @state.currentThread,
message: @_lastMessage(),
type: 'reply',
behavior: 'prefer-existing',
})
'core:reply-all': =>
Actions.composeReply({
thread: @state.currentThread,
message: @_lastMessage(),
type: 'reply-all',
behavior: 'prefer-existing',
})
'core:forward': => @_onForward()
'core:print-thread': => @_onPrintThread()
'core:messages-page-up': => @_onScrollByPage(-1)
'core:messages-page-down': => @_onScrollByPage(1)
if @state.canCollapse
handlers['message-list:toggle-expanded'] = => @_onToggleAllMessagesExpanded()
handlers
_getMessageContainer: (clientId) =>
@refs["message-container-#{clientId}"]
_focusDraft: (draftElement) =>
# Note: We don't want the contenteditable view competing for scroll offset,
# so we block incoming childScrollRequests while we scroll to the new draft.
@_draftScrollInProgress = true
fix(draft-speed): Optimize draft creation and reduce scroll / focus delays Summary: This diff attempts to improve the responsiveness of the app when you hit "Reply". This is achieved by being smarter about creating the draft and loading it into the draft store, and also by allowing the compose* actions to take objects instead of just IDs (resulting in a fetch of the object). Allow Actions.composeReply,etc. to optionally be called with thread and message objects instead of IDs. This prevents a database lookup and the data is "right there." Create DraftStoreProxy for new drafts optimistically—this allows us to hand it the draft model we just created and it doesn't have to go query for it When we create a new Draft, immediately bind it to a LocalId. This means that when the MessageStore receives the trigger() event from the Database, it doesn't have to wait while a localId is created When MessageStore sees a new Message come in which is on the current thread, a draft, and not in the localIds map, assume it's a new draft and shortcut fetchFromCaceh to manually add it to the items array and display. This means the user sees the... ...draft instantly. Remove delays from focusing draft, scrolling to draft after content is ready. I actually removed these thinking it would break something, and it didn't break anything.... Maybe new Chromium handles better? Fix specs Test Plan: Run specs - more in progress right now Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1598
2015-06-06 02:38:30 +08:00
draftElement.focus()
@refs.messageWrap.scrollTo(draftElement, {
position: ScrollRegion.ScrollPosition.Top,
settle: true,
done: =>
@_draftScrollInProgress = false
})
_onForward: =>
return unless @state.currentThread
Actions.composeForward(thread: @state.currentThread)
render: =>
if not @state.currentThread
return <span />
wrapClass = classNames
"messages-wrap": true
"ready": not @state.loading
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
messageListClass = classNames
"message-list": true
"height-fix": SearchableComponentStore.searchTerm isnt null
<KeyCommandsRegion
globalHandlers={@_globalKeymapHandlers()}
globalMenuItems={@_globalMenuItems()}>
<FindInThread ref="findInThread" />
<div className={messageListClass} id="message-list">
<ScrollRegion tabIndex="-1"
className={wrapClass}
scrollbarTickProvider={SearchableComponentStore}
scrollTooltipComponent={MessageListScrollTooltip}
ref="messageWrap">
{@_renderSubject()}
<div className="headers" style={position:'relative'}>
<InjectedComponentSet
className="message-list-headers"
matching={{role: "MessageListHeaders"}}
exposedProps={{thread: @state.currentThread, messages: @state.messages}}
direction="column"
/>
</div>
{@_messageElements()}
</ScrollRegion>
<Spinner visible={@state.loading} />
</div>
</KeyCommandsRegion>
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
_renderSubject: ->
subject = @state.currentThread.subject
subject = "(No Subject)" if not subject or subject.length is 0
<div className="message-subject-wrap">
<MailImportantIcon thread={@state.currentThread}/>
<div style={flex: 1}>
<span className="message-subject">{subject}</span>
feat(SFDC): Initial SFDC commit Fixes to generated form error handling Remove console fix css Styles with tokenizing field and generated form Gen form fixes for required Gen form styles Fix datepicker in generated form Can compute plain text for messages Add resolvePath. Fix bug in sidebar scoring Plaintext fixes Use new syntax for global plugin actions fix(styles): fix input[type='url'] syntax error in inputs.less Remove sendToAllWindows action Style fix to generated form bump(SFDC): 0.4.100 Trigger AppVeyor Trigger AppVeyor Add ci-build to appveyor yml Only build mac Publish all builds that make it to AppVeyor or Travis Bump submodule Update submodule to init recursively for appveyor feat(win): add getAllWindowDimensions bump(SFDC): 0.4.101 fix(form): generated form handles disabled inputs Make tokeizing field editable bump(SFDC): 0.4.102 bump(SFDC): 0.4.103 bump(SFDC): 0.4.104 bump(SFDC): 0.4.105 :art:(salesforce): Highlight prefilled fields Form fixes Fix prefill class Fix z-index of fieldsets Refactor our BoldedSearchResult component Move and split sidebar section into thread list and toolbar Fixing referenceTo bump(SFDC): 0.4.106 bump(SFDC): 0.4.107 bump(SFDC): 0.4.108 Fix delete object from form Don't show tokenizing input field borders on window Close popover after adding existing opportunity Fix required fields bump(SFDC): 0.4.109 Merge submodule with master Only store raw data for full object fetches Use Salesforce error reporter Refactor form and smart fields Fix form validation Remove DOM form validation bump(SFDC): 0.4.110 Fix mini month view bump(SFDC): 0.4.111 Fix Record Type layouts bump(SFDC): 0.4.113 Fix click target bump(version): 0.4.53 and update Changelog fix(changelog): Update changelog to reflect latest puublished release fix(thread-sharing): Update popover style bump(build) fix(thread-sharing): Find-thread, incr timestamp delta to 1min in ms :art:(thread-sharing): Prefer url and querystring modules to parse url fix(mail-merge): Correctly handle empty column names fix(thread-sharing): Throw error when thread is /not/ found fix(thread-sharing): Timestamp range in seconds fix(N1.sh): Allow path to working copy to have spaces bump(electron): Electron 1.4, node-sqlite 3.1.4+fts fix(keymaps): Correctly map mod+z to undo, instead of just z (#2663) fix(tutorial): Minor tweaks, finalized styling Add link for Darkish theme (#2854) Fix typo: dependencesi > dependencies (#2838) feat(channels): Choose an update channel! Limited time only! Summary: Just a small select input. Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3282 fix(logging): Fix query logging: escape '%' properly fix(trial): Compute “days remaining” in timezone-aware way fix(util): Utils.deepClone properly clones dates Merge submodule with master bump(SFDC): 0.4.114 fix(trial): Move”days left” bar to the sidebar, new design fix(lint): import ui-variables for linter Refactor object store and gen form updates feat(msg-list): Don't make participants mailto links, add context menu fix(long-connection): Throw error for reporting, instead of just logging design tweaks, breaking css up into files, update readme (#2858) fix(darkside): `script/grunt lint` requires explicit LESS includes fix(specs): Display which tests are console.logging fix(promise): Don't use deprecated Promise.longStackTraces() fix(error): Let APIErrors have proper stack traces Update submodule Revert "fix(promise): Don't use deprecated Promise.longStackTraces()" This reverts commit ac7602155ce75c3d175e4610cd97c020ed798883. Bump submodule bump(SFDC): 0.4.115 fix(specs): Fix tests that were console.logging, bump coffee-react fix(drag-drop): Restore support for thread dragging fix(thread-sharing): Fix unloading plugin fix(auth): Update autofill for Fastmail.fm fix(tooltips): Position relative to custom container for composer lint(*): Fix issue breaking the build bump(react): 15.3.x, warning removal, thread-sharing tweaks es6(db): Convert attribute class declarations to ES2016 es6(db): Didn’t wait for NylasLint… hack(channel-picker): Hide Salesforce for now fix(accounts): Restore account re-ordering fix(specs): attribute conversion fixed bugs, broke specs fix(task-queue): performLocal now operates serially Revert "fix(task-queue): performLocal now operates serially" This reverts commit 5274ce3543f45b4948be6b54b116342c42bf31bd. Add back in `isSameDomainAsMe` es6(db): Query-related classes moved to ES2016 fix(task-queue): task queue dependencies are only for preceding tasks bump(SFDC): 0.4.116 Revert "fix(task-queue): task queue dependencies are only for preceding tasks" This reverts commit e1e8c1cd9429b5aa20e19d4e2b8eca7215aa4a2c. Add sequentialId check to tasks Design pass on SF icons fix(search/long-conn): Process results buffer before ending connection (#750) NylasLongConnection ends the connection when the 'end' event is emitted by the `request` object. When this happens, the global connection buffer is cleared. Also, the global buffer holds the data we've received from the connection, and whenever we receive new data, we accumulate it in the buffer and call a processBuffer function which is throttled to 400ms. Given that the buffer is global state, and processing occurs asynchronously with a delay of up to 400ms, if the 'end' event on the connection is fired before we actually get to process the buffer, we would clear it and show no results. This scenario currently only affected search because if we accidentally threw away some data when streaming deltas, we will get that data again when we reopen the delta streaming connection. fix(tray): Flipped logic in displaying unread count Add section to Message footer bump(SFDC): 0.4.117 fix linter bump(electron): Update to 1.4.1 to fix intermittent Symbol() error es6(db): Query builder converted to ES6 fix(long-connection): `close` instead of `end` on network end event NylasLongConnection.Status.Ended means that we can't open the connection again. When we get a network level 'end' event, that doesn't map to our meaning of `Ended`, so we should just close it instead Fix db setup bump(SFDC): 0.4.118 feat(transforms): Replace regexp body transforms with DOM approach Summary: We originally didn't do this because creating a DOM tree was loading images. Using range.createContextualFragment seems to do it without the tree ever being attached. Accompanying changes to src/pro are here: https://phab.nylas.com/D3300 https://github.com/nylas/edgehill/compare/bengotow/draft-dom-transformations?expand=1 Also rename applyTransformsToDraft => applyTransformsForSending. Needed a new name because the function signature has changed. AFAIK there are no open source plugins using the old functions. Test Plan: All specs updated Reviewers: evan, juan Reviewed By: evan, juan Differential Revision: https://phab.nylas.com/D3299 fix(tooltips): Defer display of background, ensure dot inside window bump(SFDC): 0.4.119 Merged in latest master from N1 fix(attribute): fix es6 conversion error bump(SFDC): 0.4.120 Include calendar fix fix(warnings): Fix warnings for react unkown dom prop When using the pattern `{...extraProps}` to transfer props in the render method, if rendering a native dom element, react will issue a new warning if we end up passing invalid dom props: https://facebook.github.io/react/warnings/unknown-prop.html This adds a helper library to exclude invalid fom props instead of manually excluding props inside each render method fix(attribute): fix es6 conversion error fix(mail-merge): fix `applyExtensionTransformsToDraft` rename bump(SFDC): 0.4.121 Add welcome modal with video Move close button to modal component and update styling Fix linter errors fix(help): Better help URL fix(mail-merge): Add test coverage Add jitter to BackoffTimer Summary: This should help us avoid the thundering herd problem if we have some kind of API outage affecting a wide number of clients. Test Plan: Tests Reviewers: bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D3297 fix(contact-sidebar): Correctly update selected contact Sometimes, when selecting a contact (with name, email) inside a thread, the dropdown (`<select>`) did not correctly reflect the selected contact. This was because when focusing a contact, the FocusedContactStore queried that contact from the database just by email, and the contact retured from the database became the focused one. However, sometimes the returned contact might have the same email but different email, and given that the `<select>` component is keyed by both name,email, it couldn't find the appropriate <option> to render, so it could not update to reflect the newly selected contact Now, the FocusedContactStore queries by email and name to prevent this Fix broken test Summary: Fixes a test that was broken due to my unfamiliarity with CoffeeScript :-/ Test Plan: Tests Reviewers: bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D3302 feat(inline-images): Drag & drop or paste inline images Summary: Initial support for inline images. Tests still forthcoming! Test Plan: WIP Reviewers: mark, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3295 Revert "fix(task-queue): performLocal now operates serially" This reverts commit 5274ce3543f45b4948be6b54b116342c42bf31bd. fix(lint) es6(db): DatabaseTransaction & Query moved to ES6 fix(tasks): Add instrumentation to Task's performLocal A slow performLocal may be one of the causes of #2725 update: Update CHANGELOG for v0.4.55 fix(whitespace) fix(install-location): Update language and remove buggy regex fix(tasks): Report slow performLocal only when it takes > 500ms fix(mail-merge): Reduce max number of emails to 250 Almost always, you will get rate limited trying to send 500 emails. Reduce to 250 to make it more reasonable 💄(sidebar): Github repos should not wrap fix(sidebar): Command-click + href to open in background Global window event handler should work when clicking elements /inside/ of an a tag with an href. 💄(mail-merge): Fix alignment and height of tokens fix(composer): No need for overlaid z-index: 10, appearing over menus fix(db): Add an index on Thread.client_id for modelify fix(overlaid-comps): Check if supports preview only after we know exists fix(warnings): Correctly remove all unknown props warnings fix(thread-list): Use interaction handlers, don’t update selection directly fix(drafts): Sanitize quoted text to avoid overlaid component issues [!!] fix(lint): Change variable to const fix(search): Update local search syntax to include more results Add prefix search. Previously, if searching for a thread with a specific subject, you had to type the entire subject. Searching for just a prefix wouldn't return the result. This should not affect any of the current search results, only add more results fix(react): React refuses to add `partition` attr to webview fix(identity): Always refresh accounts after identity This fixes an issue where changing your Nylas ID didn’t refresh your accounts, and N1 would still think they were invalid. fix(db): Messages with empty bodies always showing loading spinner due to ‘’ == null Bump submodule fix(composer): Dedupe registered key bindings to avoid double undo in composer fix(calendar): CSS layout fix for Chromium 53 fix(mail-merge): Reduce limit to 150 messages, improve error handling fix(composer): Add additional isMounted checks Resolves this exception: https://gist.github.com/jstejada/a26dc6a7a2896dcef9be3cec60eaecdb fix(perspectives): More robust validation of saved perspectives, never open to blank screen fix(specs): Fix mail merge specs :art:(thread-sharing): Fix icon fix(lint): Fix coffeelint errors fix(draft-list): Don't render html string in draft subject fix(dev): Pretty print deltas :art:(activity-list): punctuation fix(window-state): Per electron#7278, save state in beforeunload Related: https://github.com/electron/electron/issues/7278 https://github.com/atom/atom/pull/3223/files As of Chromium 36, unload is async and @zcbenz does not think it happens reliabily in Electron. Move saving of window state to beforeunload, following suit with Atom. fix(composer): Wrap composer instead of allowing overflow-x fix(spec): remove unnecessary messages & prevent extra hot window bump(SFDC): 0.4.123 fix(linter): fix linter error fix(linter): fix linter error rm(ship-logs): Remove unused log shipping, prevents many-processes bug on win32 feat(bios): Linkify twitter hashtags and mentions in bios fix(composer): When pasting links that are tracked, extract actual link fix(self-hosting) Don't load packages that don't support self-hosting feat(self-hosting) Add onboarding page about self-hosting plugin restrictions bump(verison): 0.4.56, more items in changelog fix(data-source): Wait until the next cycle to cleanup Fixes a crash when switching to the thread list from the draft list, where there are very briefly zero observers. :lipstick:(share-thread): Fix positioning of share thread button fix(tutorial-tips): Don't display when component is not visible fix(participants): When copying, include space #2871 fix(spellcheck): Do not spellcheck <code>, <a>, <pre> tags This fixes #2877. The templates feature becomes broken when variable names contain misspellings. fix(specs): Minor spec fixes fix(composer): enable click regions on margins of composer Change padding, margins, and borders to allow you to click on the left margin of to, cc, bcc, from, subject fields as well as the composer margins both above, left, and to the right of the composer. Ensured attachments and other assets show up in correct spots Ensure subject looks correct for mail merge fix(composer): can shift-tab more places Allow shift-tab to go back to subject from anywhere except in front of a tab character fix(composer): fix margin when editing contact chip fix(composer): tokenizing text field trigger logic moved to composer Put acess tokens and refresh tokens in keychain fix modal spacing bump(SFDC): 0.4.125 fix tokenizing field margins fix(tutorial-tips): Recompute pos when theme changes fix(share-thread): Closed when blurred when blurred or new thread selected fix(dev-mode): Don’t save to config.json, use flag instead Turns out even the built, packaged version of the app can be restarted into dev mode by adding `—dev` to argv and using the new relaunch API. es6(db): Move DatabaseStore to ES6 :lipstick:(outline-view): Add title attr for tooltips fix+:art:(notifs): Cleanup, handle nonexistent thread when opening notification Notifications now check to see the thread they are supposed to open exists. Also, clean up FocusedContentStore._onFocus so that it doesn't have the side effect of dispatching another action and messay logic. Instead, added Actions.ensureCategoryFocused, to focus any category, and which should be used separately from focusing content (notifications now use this action for "opening" the thread) Also, convert FocusedPerspectiveStore to ES6 fix(specs): Activity List fix(composer): enable click regions on margins of composer Change padding, margins, and borders to allow you to click on the left margin of to, cc, bcc, from, subject fields as well as the composer margins both above, left, and to the right of the composer. Ensured attachments and other assets show up in correct spots Ensure subject looks correct for mail merge fix(composer): can shift-tab more places Allow shift-tab to go back to subject from anywhere except in front of a tab character fix(composer): fix margin when editing contact chip fix(composer): tokenizing text field trigger logic moved to composer :hocho: Last remaining traces of coffeescript in submodule! fix(tools): Make `arc lint` great again Add proper arc config for linting ES6 files with eslint fix(files): When download mode is “manual” prompt about inline attachments Summary: When you have your "Download attachments for new mail" setting set to "manually", inline images always appear broken with no explanation. This patch listens for the image load to fail and displays a button which queues the fetchFile task on click. This seemed like the best approach because it doesn't slow down the loading of the message with more fstats / lookups. (Seeing if the file has already been downloaded is an async operation) Test Plan: No specs atm Reviewers: evan, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3313 feat(sidebar-notifs) Create sidebar notifications to replace old bars Summary: Move the old bar notifications to the sidebar, and only display one notification at a time using a priority-rating system. Remove all of the old notification infrastructure. Test Plan: Added specs, also reproduced notifications locally Reviewers: bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D3310 bump(submodule) fix(lint) fix(phising): Handle scenarios where input is malformed (Sentry 51642) https://sentry.nylas.com/sentry/edgehill/group/51642/ fix(templates): Handle error when scanning dir (Sentry 44351) https://sentry.nylas.com/sentry/edgehill/group/44351/ fix(perspectives): Restore when only account cannot be found (Sentry 59061) https://sentry.nylas.com/sentry/edgehill/group/59061/ refator(notification): move base notification to nylas-component-kit Remove all salesforce objects on logout Add syncing of salesforce objects Summary: Depends on D3327 - Also remove all coffeescript - Make it so salesforce mail label grabs opportunity from database - Make sure metadata is kept in sync when salesforce objects are deleted - Set up stub for Salesforce Object cache via SalesforceObjectStore - Cleanups here and there Test Plan: Manual Reviewers: jackie, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3328 fix(db): Switch to better-sqlite3, resolves offline issue Summary: Better-SQLite3 is a fork of node-sqlite3 which includes a re-written JavaScript interface. It’s more synchronous, but better reflects what is actually sync vs. async in sqlite’s C++ API. (Not much is really async under the hood.) This diff uses a branch of better-sqlite3 I’ve edited to support Node 6. In my tests, this branch spends 3.24x less time executing queries than `master`. (Measured time spent in calls to `this._db[run|all|get]` over the first 5000 queries of initial sync. It also increased the performance of starring a thread in the thread list by 28%. This library also allows us to use a prepared statement cache, which is great because we often make the same queries repeatedly as query subscriptions refresh the UI and deltas are dumped into the app. The old interface didn’t expose statements (cached query plans) to JS. better-sqlite3 advertises that it uses the JS garbage collector instead of lower level C++ memory management. I tested syncing my entire mailbox to verify that memory usage is not significantly different on this branch after a lot of queries have been made. Finally, it looks like we can finally stop building sqlite3 from scratch in `script/bootstrap`. This library builds properly with `apm install`. 🎉 We might want to change the DatabaseStore and DatabaseTransaction classes more, now that it’s possible to execute queries synchronously. It could make things cleaner and get us out of promise-hell in a few places. In this diff I tried to change as little as possible. Test Plan: Run tests, everything still works Reviewers: juan, jackie Reviewed By: juan, jackie Differential Revision: https://phab.nylas.com/D3315 Fixing broken screenshot link (#2911) Replacing with new screenshot fix(onboarding): Fire event when user selects account type bump(sqlite3): Fix issue with CI build / bindings location fix(reporter): Handle errors cleaning log files (Sentry #6887) Switch spellcheck libaries Summary: Switch to electron-spellchecker, which will allow N1 to spellcheck more intelligently across languages. It auto- detects languages and downloads dictionaries on the fly. Test Plan: Specs, manual testing Reviewers: bengotow, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3319 Update Windows.md fix(jquery): remove jquery fix(spec): remove unused spec helpers fix(specs) convert nylas-protocol-handler-spec to ES6 (#2886) fix(win32): Still need custom sqlite3 build cmd for win32 😥 This also includes a bump of the better-sqlite3 module to support compilation on ia32. feat(popout-threads) Add functionality to open threads in popout windows Summary: Threads can now be opened in separate windows. This can be done via the popout icon next to the print icon, or by double-clicking the thread when in double- pane mode. Note that the single-click action is still fired, which is why double-clicking does not work in single-pane mode. The popout icon changes to a pop-in icon while in the popout window, to allow users to collapse it back into the main window. Test Plan: Tested locally Reviewers: evan, juan Reviewed By: juan Subscribers: sdw Differential Revision: https://phab.nylas.com/D3332 fix(analytics): Add pgp encryption events Email Encrypted Email Encryption Errored Email Decrypted Email Decryption Errored feat(win32): Allow N1 to become the system-wide mailto: handler Summary: This will address the longstanding concern in #417 Test Plan: No new tests Reviewers: juan, evan Reviewed By: juan, evan Maniphest Tasks: T7065 Differential Revision: https://phab.nylas.com/D3322 bump(version): 0.4.57 (0.4.58 was accidentally in prev commit) fix(readme): Improve Win32 build instructions fix(readme): More Win32-specific instructions fix(spellchecker): Use cross-platform misspellings, fix lint error feat(calendar): can pick which calendars you want displayed Summary: Adds a resizable column next to the calendar that lets you pick which calendars you want to turn on and off. The picker sidebar styling mimics that of the main account sidebar. Calendars are grouped by account. We store the disabled calendars in in your config. I added a `notIn` SQL method so it'll perform `WHERE calendarId NOT IN ['a', 'b', ...]` instead of `NOT (WHERE calendarId IN ['a', 'b', 'c'])` I wanted it to be an exclusion (instead of inclusion) list so the default was "all on" and we didn't need to always fetch the full list of calendarIds from the database to compare against. This also fixed a test that was failing constantly: The Query Subscription Pool Spec was not being properly reset on each test. As a result, the test would fail with an instance of a query subscription that Jasmine would attempt to pretty print. Jasmine would fail to pretty print it because of a jasmine bug that fails to properly display Objects with null prototypes. The DatabaseStore's EventEmitter has a property with a null prototyp causing the error Test Plan: manual Reviewers: bengotow, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3336 fix(linter) Merge submodule with master Bump submodule Bump database version and submodule fix(contact): add hasSameDomainAsMe method to Contact Better email syncing with Salesforce feat(dock): Automatically add N1 to the OS X dock upon install Note - you need to `killall Dock` to see this after it happens Add main window calendar package Summary: Add tiny helper app for calendar goodness Test Plan: No tests yet Reviewers: juan, halla Reviewed By: halla Differential Revision: https://phab.nylas.com/D3346 cleanup(*): Remove dead .bowerrc, .gitignore files es6(db): Convert the ORM specs to ES2016 bump(Electron): 1.4.3 fix(license): Swap ref to GPLv3 with the whole thing so GitHub picks it up Clean up spec-bootstrap and jasmine-helper Convert spec-suite to es6 Extract out jasmine reporters Move global imports back to jasmine-helper Extract to N1SpecRunner Fold jasmine-helper into spec runner Convert `spec-suite` to `n1-spec-loader` Convert spec-helper to es6 Remove unused methods from spec-helper Move waitsForPromise to jasmine-extensions Move spec runner & deps into `n1-spec-runner` folder Remove unused spec-helper-platform Move specs into subfolders Initial extraction of all methods out of of spec-helper Fixes to spec-helper extraction fix(spec): Dramatically clean up and simply the spec bootup process. Converting spec bootup system to es6 from coffee. Converted old `jasmine-helper`, `spec-helper`, and `spec-suite` to a new `n1-spec-runner` file. Each of these old files had tons and tons of code related to various parts of the spec bootup and running process. Each of those parts have been extracted into individual files Fix linter Add icons to object types in picker Remove opp references in popover bump submodule fix(spellchecker) Add a cache to improve performance fix(notifs): Don’t render empty <img /> lint(*): Bump to ESLint 3.8 Update linter bump submodule bump submodule bump submodule bump submodule bumpd submodule Add sync thread toggles Search focused contact by email fix(mailto): Support body with \n or \r characters Related to #2923 fix(thread-popout) Add missing packages to the 'thread-popout' window Summary: Missed some non-composer packages that should be in the 'thread-popout' window Test Plan: Tested locally Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D3352 fix(mailto): Missing return in URL handling fix(beta): Add notif when on beta channel fix(db): Return; preventing ThreadSearch indexing bump(version): 0.4.58 fix(specs): Don’t run update channel check in specs fix(search): React warns, convert to ES2016 fix(search): Missed a .default fix(spellcheck): Don’t include cld sources in build fix(tooltips): Prevent tooltips from breaking wrapped components fix(overlaid): Preview button was just invisible? fix(auth): Hide title when long acct. err present fix(onboarding): Don’t display “Welcome Back” screen fix(accounts): Return correct list of email addresses bump submodule fix(misc) React warnings, kill cjsx fix(accounts): Return correct list of email addresses :lipstick:(thread-window): Update pop-out icons lint(react): InlineImages don’t get session at send-time fix(mail-merge): Upload files per draft to fix inline images fix(mail-rules): Allow recipient filters to contain names #2942 bump(version): 0.4.59 :lipstick:(thread-window): Add thread-popin icon update(changelog): 0.4.59 fix(search): Use fts search index for typeahead results Summary: This improves performance of the search typeahead Test Plan: Manual Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D3363 fix(popover): :hocho: deprecated popover fix(popover) Actually :hocho: deprecated popover feat(flow): Add Flow to Nylas N1 Add flow-typed annotations Ignore annoying submodules Add /* @flow */ header to all js & es6 source files Fix error about having number keys for objects Remove @flow config from compile-support Check es6 files Add jasmine to flow Revert "Add /* @flow */ header to all js & es6 source files" This reverts commit c5a57bc402c53633b407b557f28ad12eaa8f27fe. Update submodule Add nylas global interface file Fix generated form and bump Fixes to generated form Use customComponent in task fix(warning): Don't render participant picker with null value fix(thread-popout): Display the hidden message toggle in the thread-popout Summary: Also, maintain the perspective that the thread was opened in, so that the proper messages are hidden (e.g. hide deleted messages when opened from the inbox, but not when opened from the trash folder) Test Plan: Tested locally Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3366 rm(grim): We’re not using Grim for deprecations feat(quick-replies): Reply from Mac notifications use single regex exec for toEquivalentEmailForm (#2962) Fix JSON spacing (#2958) Match JSON style to rest of file Fix issue #2758. Press Escape after a finished search to get back to … (#2939) * Fix issue #2758. Press Escape after a finished search to get back to Inbox Use a keydown event when search bar is in focus to capture escape key press * fix(search): Convert to ES2016 :art:(notifications): Remove indent and left padding from notifications Revert "Fix issue #2758. Press Escape after a finished search to get back to … (#2939)" This reverts commit 6377da8291adb2abb17e69db1e5eafb90de7ef0b. This was already fixed in https://github.com/nylas/N1/commit/a95c17bce357d99e020fadb7e86fe5c2703c4fa2 fix(utils): Don’t overwrite _ in global scope feat(tokens): Multi-select for tokenized text fields Test Plan: Lots of tests, mostly updated to enzyme. Not many new ones. Reviewers: evan, juan, jackie Reviewed By: juan, jackie Subscribers: juan Differential Revision: https://phab.nylas.com/D3374 fix(tokenizing-text): Re-add shouldBreakOnKeydown prop build: bump eslint-plugin-import version feat(field): Let TokenizingTextFields be disabled and onEditMotion
2016-08-09 05:03:41 +08:00
<MailLabelSet
removable={true}
messages={@state.messages}
feat(SFDC): Initial SFDC commit Fixes to generated form error handling Remove console fix css Styles with tokenizing field and generated form Gen form fixes for required Gen form styles Fix datepicker in generated form Can compute plain text for messages Add resolvePath. Fix bug in sidebar scoring Plaintext fixes Use new syntax for global plugin actions fix(styles): fix input[type='url'] syntax error in inputs.less Remove sendToAllWindows action Style fix to generated form bump(SFDC): 0.4.100 Trigger AppVeyor Trigger AppVeyor Add ci-build to appveyor yml Only build mac Publish all builds that make it to AppVeyor or Travis Bump submodule Update submodule to init recursively for appveyor feat(win): add getAllWindowDimensions bump(SFDC): 0.4.101 fix(form): generated form handles disabled inputs Make tokeizing field editable bump(SFDC): 0.4.102 bump(SFDC): 0.4.103 bump(SFDC): 0.4.104 bump(SFDC): 0.4.105 :art:(salesforce): Highlight prefilled fields Form fixes Fix prefill class Fix z-index of fieldsets Refactor our BoldedSearchResult component Move and split sidebar section into thread list and toolbar Fixing referenceTo bump(SFDC): 0.4.106 bump(SFDC): 0.4.107 bump(SFDC): 0.4.108 Fix delete object from form Don't show tokenizing input field borders on window Close popover after adding existing opportunity Fix required fields bump(SFDC): 0.4.109 Merge submodule with master Only store raw data for full object fetches Use Salesforce error reporter Refactor form and smart fields Fix form validation Remove DOM form validation bump(SFDC): 0.4.110 Fix mini month view bump(SFDC): 0.4.111 Fix Record Type layouts bump(SFDC): 0.4.113 Fix click target bump(version): 0.4.53 and update Changelog fix(changelog): Update changelog to reflect latest puublished release fix(thread-sharing): Update popover style bump(build) fix(thread-sharing): Find-thread, incr timestamp delta to 1min in ms :art:(thread-sharing): Prefer url and querystring modules to parse url fix(mail-merge): Correctly handle empty column names fix(thread-sharing): Throw error when thread is /not/ found fix(thread-sharing): Timestamp range in seconds fix(N1.sh): Allow path to working copy to have spaces bump(electron): Electron 1.4, node-sqlite 3.1.4+fts fix(keymaps): Correctly map mod+z to undo, instead of just z (#2663) fix(tutorial): Minor tweaks, finalized styling Add link for Darkish theme (#2854) Fix typo: dependencesi > dependencies (#2838) feat(channels): Choose an update channel! Limited time only! Summary: Just a small select input. Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3282 fix(logging): Fix query logging: escape '%' properly fix(trial): Compute “days remaining” in timezone-aware way fix(util): Utils.deepClone properly clones dates Merge submodule with master bump(SFDC): 0.4.114 fix(trial): Move”days left” bar to the sidebar, new design fix(lint): import ui-variables for linter Refactor object store and gen form updates feat(msg-list): Don't make participants mailto links, add context menu fix(long-connection): Throw error for reporting, instead of just logging design tweaks, breaking css up into files, update readme (#2858) fix(darkside): `script/grunt lint` requires explicit LESS includes fix(specs): Display which tests are console.logging fix(promise): Don't use deprecated Promise.longStackTraces() fix(error): Let APIErrors have proper stack traces Update submodule Revert "fix(promise): Don't use deprecated Promise.longStackTraces()" This reverts commit ac7602155ce75c3d175e4610cd97c020ed798883. Bump submodule bump(SFDC): 0.4.115 fix(specs): Fix tests that were console.logging, bump coffee-react fix(drag-drop): Restore support for thread dragging fix(thread-sharing): Fix unloading plugin fix(auth): Update autofill for Fastmail.fm fix(tooltips): Position relative to custom container for composer lint(*): Fix issue breaking the build bump(react): 15.3.x, warning removal, thread-sharing tweaks es6(db): Convert attribute class declarations to ES2016 es6(db): Didn’t wait for NylasLint… hack(channel-picker): Hide Salesforce for now fix(accounts): Restore account re-ordering fix(specs): attribute conversion fixed bugs, broke specs fix(task-queue): performLocal now operates serially Revert "fix(task-queue): performLocal now operates serially" This reverts commit 5274ce3543f45b4948be6b54b116342c42bf31bd. Add back in `isSameDomainAsMe` es6(db): Query-related classes moved to ES2016 fix(task-queue): task queue dependencies are only for preceding tasks bump(SFDC): 0.4.116 Revert "fix(task-queue): task queue dependencies are only for preceding tasks" This reverts commit e1e8c1cd9429b5aa20e19d4e2b8eca7215aa4a2c. Add sequentialId check to tasks Design pass on SF icons fix(search/long-conn): Process results buffer before ending connection (#750) NylasLongConnection ends the connection when the 'end' event is emitted by the `request` object. When this happens, the global connection buffer is cleared. Also, the global buffer holds the data we've received from the connection, and whenever we receive new data, we accumulate it in the buffer and call a processBuffer function which is throttled to 400ms. Given that the buffer is global state, and processing occurs asynchronously with a delay of up to 400ms, if the 'end' event on the connection is fired before we actually get to process the buffer, we would clear it and show no results. This scenario currently only affected search because if we accidentally threw away some data when streaming deltas, we will get that data again when we reopen the delta streaming connection. fix(tray): Flipped logic in displaying unread count Add section to Message footer bump(SFDC): 0.4.117 fix linter bump(electron): Update to 1.4.1 to fix intermittent Symbol() error es6(db): Query builder converted to ES6 fix(long-connection): `close` instead of `end` on network end event NylasLongConnection.Status.Ended means that we can't open the connection again. When we get a network level 'end' event, that doesn't map to our meaning of `Ended`, so we should just close it instead Fix db setup bump(SFDC): 0.4.118 feat(transforms): Replace regexp body transforms with DOM approach Summary: We originally didn't do this because creating a DOM tree was loading images. Using range.createContextualFragment seems to do it without the tree ever being attached. Accompanying changes to src/pro are here: https://phab.nylas.com/D3300 https://github.com/nylas/edgehill/compare/bengotow/draft-dom-transformations?expand=1 Also rename applyTransformsToDraft => applyTransformsForSending. Needed a new name because the function signature has changed. AFAIK there are no open source plugins using the old functions. Test Plan: All specs updated Reviewers: evan, juan Reviewed By: evan, juan Differential Revision: https://phab.nylas.com/D3299 fix(tooltips): Defer display of background, ensure dot inside window bump(SFDC): 0.4.119 Merged in latest master from N1 fix(attribute): fix es6 conversion error bump(SFDC): 0.4.120 Include calendar fix fix(warnings): Fix warnings for react unkown dom prop When using the pattern `{...extraProps}` to transfer props in the render method, if rendering a native dom element, react will issue a new warning if we end up passing invalid dom props: https://facebook.github.io/react/warnings/unknown-prop.html This adds a helper library to exclude invalid fom props instead of manually excluding props inside each render method fix(attribute): fix es6 conversion error fix(mail-merge): fix `applyExtensionTransformsToDraft` rename bump(SFDC): 0.4.121 Add welcome modal with video Move close button to modal component and update styling Fix linter errors fix(help): Better help URL fix(mail-merge): Add test coverage Add jitter to BackoffTimer Summary: This should help us avoid the thundering herd problem if we have some kind of API outage affecting a wide number of clients. Test Plan: Tests Reviewers: bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D3297 fix(contact-sidebar): Correctly update selected contact Sometimes, when selecting a contact (with name, email) inside a thread, the dropdown (`<select>`) did not correctly reflect the selected contact. This was because when focusing a contact, the FocusedContactStore queried that contact from the database just by email, and the contact retured from the database became the focused one. However, sometimes the returned contact might have the same email but different email, and given that the `<select>` component is keyed by both name,email, it couldn't find the appropriate <option> to render, so it could not update to reflect the newly selected contact Now, the FocusedContactStore queries by email and name to prevent this Fix broken test Summary: Fixes a test that was broken due to my unfamiliarity with CoffeeScript :-/ Test Plan: Tests Reviewers: bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D3302 feat(inline-images): Drag & drop or paste inline images Summary: Initial support for inline images. Tests still forthcoming! Test Plan: WIP Reviewers: mark, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3295 Revert "fix(task-queue): performLocal now operates serially" This reverts commit 5274ce3543f45b4948be6b54b116342c42bf31bd. fix(lint) es6(db): DatabaseTransaction & Query moved to ES6 fix(tasks): Add instrumentation to Task's performLocal A slow performLocal may be one of the causes of #2725 update: Update CHANGELOG for v0.4.55 fix(whitespace) fix(install-location): Update language and remove buggy regex fix(tasks): Report slow performLocal only when it takes > 500ms fix(mail-merge): Reduce max number of emails to 250 Almost always, you will get rate limited trying to send 500 emails. Reduce to 250 to make it more reasonable 💄(sidebar): Github repos should not wrap fix(sidebar): Command-click + href to open in background Global window event handler should work when clicking elements /inside/ of an a tag with an href. 💄(mail-merge): Fix alignment and height of tokens fix(composer): No need for overlaid z-index: 10, appearing over menus fix(db): Add an index on Thread.client_id for modelify fix(overlaid-comps): Check if supports preview only after we know exists fix(warnings): Correctly remove all unknown props warnings fix(thread-list): Use interaction handlers, don’t update selection directly fix(drafts): Sanitize quoted text to avoid overlaid component issues [!!] fix(lint): Change variable to const fix(search): Update local search syntax to include more results Add prefix search. Previously, if searching for a thread with a specific subject, you had to type the entire subject. Searching for just a prefix wouldn't return the result. This should not affect any of the current search results, only add more results fix(react): React refuses to add `partition` attr to webview fix(identity): Always refresh accounts after identity This fixes an issue where changing your Nylas ID didn’t refresh your accounts, and N1 would still think they were invalid. fix(db): Messages with empty bodies always showing loading spinner due to ‘’ == null Bump submodule fix(composer): Dedupe registered key bindings to avoid double undo in composer fix(calendar): CSS layout fix for Chromium 53 fix(mail-merge): Reduce limit to 150 messages, improve error handling fix(composer): Add additional isMounted checks Resolves this exception: https://gist.github.com/jstejada/a26dc6a7a2896dcef9be3cec60eaecdb fix(perspectives): More robust validation of saved perspectives, never open to blank screen fix(specs): Fix mail merge specs :art:(thread-sharing): Fix icon fix(lint): Fix coffeelint errors fix(draft-list): Don't render html string in draft subject fix(dev): Pretty print deltas :art:(activity-list): punctuation fix(window-state): Per electron#7278, save state in beforeunload Related: https://github.com/electron/electron/issues/7278 https://github.com/atom/atom/pull/3223/files As of Chromium 36, unload is async and @zcbenz does not think it happens reliabily in Electron. Move saving of window state to beforeunload, following suit with Atom. fix(composer): Wrap composer instead of allowing overflow-x fix(spec): remove unnecessary messages & prevent extra hot window bump(SFDC): 0.4.123 fix(linter): fix linter error fix(linter): fix linter error rm(ship-logs): Remove unused log shipping, prevents many-processes bug on win32 feat(bios): Linkify twitter hashtags and mentions in bios fix(composer): When pasting links that are tracked, extract actual link fix(self-hosting) Don't load packages that don't support self-hosting feat(self-hosting) Add onboarding page about self-hosting plugin restrictions bump(verison): 0.4.56, more items in changelog fix(data-source): Wait until the next cycle to cleanup Fixes a crash when switching to the thread list from the draft list, where there are very briefly zero observers. :lipstick:(share-thread): Fix positioning of share thread button fix(tutorial-tips): Don't display when component is not visible fix(participants): When copying, include space #2871 fix(spellcheck): Do not spellcheck <code>, <a>, <pre> tags This fixes #2877. The templates feature becomes broken when variable names contain misspellings. fix(specs): Minor spec fixes fix(composer): enable click regions on margins of composer Change padding, margins, and borders to allow you to click on the left margin of to, cc, bcc, from, subject fields as well as the composer margins both above, left, and to the right of the composer. Ensured attachments and other assets show up in correct spots Ensure subject looks correct for mail merge fix(composer): can shift-tab more places Allow shift-tab to go back to subject from anywhere except in front of a tab character fix(composer): fix margin when editing contact chip fix(composer): tokenizing text field trigger logic moved to composer Put acess tokens and refresh tokens in keychain fix modal spacing bump(SFDC): 0.4.125 fix tokenizing field margins fix(tutorial-tips): Recompute pos when theme changes fix(share-thread): Closed when blurred when blurred or new thread selected fix(dev-mode): Don’t save to config.json, use flag instead Turns out even the built, packaged version of the app can be restarted into dev mode by adding `—dev` to argv and using the new relaunch API. es6(db): Move DatabaseStore to ES6 :lipstick:(outline-view): Add title attr for tooltips fix+:art:(notifs): Cleanup, handle nonexistent thread when opening notification Notifications now check to see the thread they are supposed to open exists. Also, clean up FocusedContentStore._onFocus so that it doesn't have the side effect of dispatching another action and messay logic. Instead, added Actions.ensureCategoryFocused, to focus any category, and which should be used separately from focusing content (notifications now use this action for "opening" the thread) Also, convert FocusedPerspectiveStore to ES6 fix(specs): Activity List fix(composer): enable click regions on margins of composer Change padding, margins, and borders to allow you to click on the left margin of to, cc, bcc, from, subject fields as well as the composer margins both above, left, and to the right of the composer. Ensured attachments and other assets show up in correct spots Ensure subject looks correct for mail merge fix(composer): can shift-tab more places Allow shift-tab to go back to subject from anywhere except in front of a tab character fix(composer): fix margin when editing contact chip fix(composer): tokenizing text field trigger logic moved to composer :hocho: Last remaining traces of coffeescript in submodule! fix(tools): Make `arc lint` great again Add proper arc config for linting ES6 files with eslint fix(files): When download mode is “manual” prompt about inline attachments Summary: When you have your "Download attachments for new mail" setting set to "manually", inline images always appear broken with no explanation. This patch listens for the image load to fail and displays a button which queues the fetchFile task on click. This seemed like the best approach because it doesn't slow down the loading of the message with more fstats / lookups. (Seeing if the file has already been downloaded is an async operation) Test Plan: No specs atm Reviewers: evan, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3313 feat(sidebar-notifs) Create sidebar notifications to replace old bars Summary: Move the old bar notifications to the sidebar, and only display one notification at a time using a priority-rating system. Remove all of the old notification infrastructure. Test Plan: Added specs, also reproduced notifications locally Reviewers: bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D3310 bump(submodule) fix(lint) fix(phising): Handle scenarios where input is malformed (Sentry 51642) https://sentry.nylas.com/sentry/edgehill/group/51642/ fix(templates): Handle error when scanning dir (Sentry 44351) https://sentry.nylas.com/sentry/edgehill/group/44351/ fix(perspectives): Restore when only account cannot be found (Sentry 59061) https://sentry.nylas.com/sentry/edgehill/group/59061/ refator(notification): move base notification to nylas-component-kit Remove all salesforce objects on logout Add syncing of salesforce objects Summary: Depends on D3327 - Also remove all coffeescript - Make it so salesforce mail label grabs opportunity from database - Make sure metadata is kept in sync when salesforce objects are deleted - Set up stub for Salesforce Object cache via SalesforceObjectStore - Cleanups here and there Test Plan: Manual Reviewers: jackie, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3328 fix(db): Switch to better-sqlite3, resolves offline issue Summary: Better-SQLite3 is a fork of node-sqlite3 which includes a re-written JavaScript interface. It’s more synchronous, but better reflects what is actually sync vs. async in sqlite’s C++ API. (Not much is really async under the hood.) This diff uses a branch of better-sqlite3 I’ve edited to support Node 6. In my tests, this branch spends 3.24x less time executing queries than `master`. (Measured time spent in calls to `this._db[run|all|get]` over the first 5000 queries of initial sync. It also increased the performance of starring a thread in the thread list by 28%. This library also allows us to use a prepared statement cache, which is great because we often make the same queries repeatedly as query subscriptions refresh the UI and deltas are dumped into the app. The old interface didn’t expose statements (cached query plans) to JS. better-sqlite3 advertises that it uses the JS garbage collector instead of lower level C++ memory management. I tested syncing my entire mailbox to verify that memory usage is not significantly different on this branch after a lot of queries have been made. Finally, it looks like we can finally stop building sqlite3 from scratch in `script/bootstrap`. This library builds properly with `apm install`. 🎉 We might want to change the DatabaseStore and DatabaseTransaction classes more, now that it’s possible to execute queries synchronously. It could make things cleaner and get us out of promise-hell in a few places. In this diff I tried to change as little as possible. Test Plan: Run tests, everything still works Reviewers: juan, jackie Reviewed By: juan, jackie Differential Revision: https://phab.nylas.com/D3315 Fixing broken screenshot link (#2911) Replacing with new screenshot fix(onboarding): Fire event when user selects account type bump(sqlite3): Fix issue with CI build / bindings location fix(reporter): Handle errors cleaning log files (Sentry #6887) Switch spellcheck libaries Summary: Switch to electron-spellchecker, which will allow N1 to spellcheck more intelligently across languages. It auto- detects languages and downloads dictionaries on the fly. Test Plan: Specs, manual testing Reviewers: bengotow, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3319 Update Windows.md fix(jquery): remove jquery fix(spec): remove unused spec helpers fix(specs) convert nylas-protocol-handler-spec to ES6 (#2886) fix(win32): Still need custom sqlite3 build cmd for win32 😥 This also includes a bump of the better-sqlite3 module to support compilation on ia32. feat(popout-threads) Add functionality to open threads in popout windows Summary: Threads can now be opened in separate windows. This can be done via the popout icon next to the print icon, or by double-clicking the thread when in double- pane mode. Note that the single-click action is still fired, which is why double-clicking does not work in single-pane mode. The popout icon changes to a pop-in icon while in the popout window, to allow users to collapse it back into the main window. Test Plan: Tested locally Reviewers: evan, juan Reviewed By: juan Subscribers: sdw Differential Revision: https://phab.nylas.com/D3332 fix(analytics): Add pgp encryption events Email Encrypted Email Encryption Errored Email Decrypted Email Decryption Errored feat(win32): Allow N1 to become the system-wide mailto: handler Summary: This will address the longstanding concern in #417 Test Plan: No new tests Reviewers: juan, evan Reviewed By: juan, evan Maniphest Tasks: T7065 Differential Revision: https://phab.nylas.com/D3322 bump(version): 0.4.57 (0.4.58 was accidentally in prev commit) fix(readme): Improve Win32 build instructions fix(readme): More Win32-specific instructions fix(spellchecker): Use cross-platform misspellings, fix lint error feat(calendar): can pick which calendars you want displayed Summary: Adds a resizable column next to the calendar that lets you pick which calendars you want to turn on and off. The picker sidebar styling mimics that of the main account sidebar. Calendars are grouped by account. We store the disabled calendars in in your config. I added a `notIn` SQL method so it'll perform `WHERE calendarId NOT IN ['a', 'b', ...]` instead of `NOT (WHERE calendarId IN ['a', 'b', 'c'])` I wanted it to be an exclusion (instead of inclusion) list so the default was "all on" and we didn't need to always fetch the full list of calendarIds from the database to compare against. This also fixed a test that was failing constantly: The Query Subscription Pool Spec was not being properly reset on each test. As a result, the test would fail with an instance of a query subscription that Jasmine would attempt to pretty print. Jasmine would fail to pretty print it because of a jasmine bug that fails to properly display Objects with null prototypes. The DatabaseStore's EventEmitter has a property with a null prototyp causing the error Test Plan: manual Reviewers: bengotow, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3336 fix(linter) Merge submodule with master Bump submodule Bump database version and submodule fix(contact): add hasSameDomainAsMe method to Contact Better email syncing with Salesforce feat(dock): Automatically add N1 to the OS X dock upon install Note - you need to `killall Dock` to see this after it happens Add main window calendar package Summary: Add tiny helper app for calendar goodness Test Plan: No tests yet Reviewers: juan, halla Reviewed By: halla Differential Revision: https://phab.nylas.com/D3346 cleanup(*): Remove dead .bowerrc, .gitignore files es6(db): Convert the ORM specs to ES2016 bump(Electron): 1.4.3 fix(license): Swap ref to GPLv3 with the whole thing so GitHub picks it up Clean up spec-bootstrap and jasmine-helper Convert spec-suite to es6 Extract out jasmine reporters Move global imports back to jasmine-helper Extract to N1SpecRunner Fold jasmine-helper into spec runner Convert `spec-suite` to `n1-spec-loader` Convert spec-helper to es6 Remove unused methods from spec-helper Move waitsForPromise to jasmine-extensions Move spec runner & deps into `n1-spec-runner` folder Remove unused spec-helper-platform Move specs into subfolders Initial extraction of all methods out of of spec-helper Fixes to spec-helper extraction fix(spec): Dramatically clean up and simply the spec bootup process. Converting spec bootup system to es6 from coffee. Converted old `jasmine-helper`, `spec-helper`, and `spec-suite` to a new `n1-spec-runner` file. Each of these old files had tons and tons of code related to various parts of the spec bootup and running process. Each of those parts have been extracted into individual files Fix linter Add icons to object types in picker Remove opp references in popover bump submodule fix(spellchecker) Add a cache to improve performance fix(notifs): Don’t render empty <img /> lint(*): Bump to ESLint 3.8 Update linter bump submodule bump submodule bump submodule bump submodule bumpd submodule Add sync thread toggles Search focused contact by email fix(mailto): Support body with \n or \r characters Related to #2923 fix(thread-popout) Add missing packages to the 'thread-popout' window Summary: Missed some non-composer packages that should be in the 'thread-popout' window Test Plan: Tested locally Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D3352 fix(mailto): Missing return in URL handling fix(beta): Add notif when on beta channel fix(db): Return; preventing ThreadSearch indexing bump(version): 0.4.58 fix(specs): Don’t run update channel check in specs fix(search): React warns, convert to ES2016 fix(search): Missed a .default fix(spellcheck): Don’t include cld sources in build fix(tooltips): Prevent tooltips from breaking wrapped components fix(overlaid): Preview button was just invisible? fix(auth): Hide title when long acct. err present fix(onboarding): Don’t display “Welcome Back” screen fix(accounts): Return correct list of email addresses bump submodule fix(misc) React warnings, kill cjsx fix(accounts): Return correct list of email addresses :lipstick:(thread-window): Update pop-out icons lint(react): InlineImages don’t get session at send-time fix(mail-merge): Upload files per draft to fix inline images fix(mail-rules): Allow recipient filters to contain names #2942 bump(version): 0.4.59 :lipstick:(thread-window): Add thread-popin icon update(changelog): 0.4.59 fix(search): Use fts search index for typeahead results Summary: This improves performance of the search typeahead Test Plan: Manual Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D3363 fix(popover): :hocho: deprecated popover fix(popover) Actually :hocho: deprecated popover feat(flow): Add Flow to Nylas N1 Add flow-typed annotations Ignore annoying submodules Add /* @flow */ header to all js & es6 source files Fix error about having number keys for objects Remove @flow config from compile-support Check es6 files Add jasmine to flow Revert "Add /* @flow */ header to all js & es6 source files" This reverts commit c5a57bc402c53633b407b557f28ad12eaa8f27fe. Update submodule Add nylas global interface file Fix generated form and bump Fixes to generated form Use customComponent in task fix(warning): Don't render participant picker with null value fix(thread-popout): Display the hidden message toggle in the thread-popout Summary: Also, maintain the perspective that the thread was opened in, so that the proper messages are hidden (e.g. hide deleted messages when opened from the inbox, but not when opened from the trash folder) Test Plan: Tested locally Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3366 rm(grim): We’re not using Grim for deprecations feat(quick-replies): Reply from Mac notifications use single regex exec for toEquivalentEmailForm (#2962) Fix JSON spacing (#2958) Match JSON style to rest of file Fix issue #2758. Press Escape after a finished search to get back to … (#2939) * Fix issue #2758. Press Escape after a finished search to get back to Inbox Use a keydown event when search bar is in focus to capture escape key press * fix(search): Convert to ES2016 :art:(notifications): Remove indent and left padding from notifications Revert "Fix issue #2758. Press Escape after a finished search to get back to … (#2939)" This reverts commit 6377da8291adb2abb17e69db1e5eafb90de7ef0b. This was already fixed in https://github.com/nylas/N1/commit/a95c17bce357d99e020fadb7e86fe5c2703c4fa2 fix(utils): Don’t overwrite _ in global scope feat(tokens): Multi-select for tokenized text fields Test Plan: Lots of tests, mostly updated to enzyme. Not many new ones. Reviewers: evan, juan, jackie Reviewed By: juan, jackie Subscribers: juan Differential Revision: https://phab.nylas.com/D3374 fix(tokenizing-text): Re-add shouldBreakOnKeydown prop build: bump eslint-plugin-import version feat(field): Let TokenizingTextFields be disabled and onEditMotion
2016-08-09 05:03:41 +08:00
thread={@state.currentThread}
includeCurrentCategories={true}
/>
</div>
{@_renderIcons()}
</div>
_renderIcons: =>
<div className="message-icons-wrap">
{@_renderExpandToggle()}
<div onClick={@_onPrintThread}>
<RetinaImg name="print.png" title="Print Thread" mode={RetinaImg.Mode.ContentIsMask}/>
</div>
{@_renderPopoutToggle()}
</div>
_renderExpandToggle: =>
return <span/> unless @state.canCollapse
if @state.hasCollapsedItems
<div onClick={@_onToggleAllMessagesExpanded}>
<RetinaImg name={"expand.png"} title={"Expand All"} mode={RetinaImg.Mode.ContentIsMask}/>
</div>
else
<div onClick={@_onToggleAllMessagesExpanded}>
<RetinaImg name={"collapse.png"} title={"Collapse All"} mode={RetinaImg.Mode.ContentIsMask}/>
</div>
_renderPopoutToggle: =>
if NylasEnv.isThreadWindow()
<div onClick={@_onPopThreadIn}>
<RetinaImg name="thread-popin.png" title="Pop thread in" mode={RetinaImg.Mode.ContentIsMask}/>
</div>
else
<div onClick={@_onPopoutThread}>
<RetinaImg name="thread-popout.png" title="Popout thread" mode={RetinaImg.Mode.ContentIsMask}/>
</div>
_renderReplyArea: =>
<div className="footer-reply-area-wrap" onClick={@_onClickReplyArea} key='reply-area'>
<div className="footer-reply-area">
<RetinaImg name="#{@_replyType()}-footer.png" mode={RetinaImg.Mode.ContentIsMask}/>
<span className="reply-text">Write a reply…</span>
</div>
</div>
_lastMessage: =>
_.last(_.filter((@state.messages ? []), (m) -> not m.draft))
# Returns either "reply" or "reply-all"
_replyType: =>
refactor(env): new NylasEnv global Converted all references of global atom to NylasEnv Temporary rename atom.io find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.io/temporaryAtomIoReplacement/g' atom.config to NylasEnv.config find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.config/NylasEnv.config/g' atom.packages -> NylasEnv.packages atom.commands -> NylasEnv.commands atom.getLoadSettings find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.commands/NylasEnv.commands/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getLoadSettings/NylasEnv.getLoadSettings/g' More common atom methods find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.styles/NylasEnv.styles/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.emitError/NylasEnv.emitError/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.inSpecMode/NylasEnv.inSpecMode/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.inDevMode/NylasEnv.inDevMode/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getWindowType/NylasEnv.getWindowType/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.displayWindow/NylasEnv.displayWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.quit/NylasEnv.quit/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.close/NylasEnv.close/g' More atom method changes find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.keymaps/NylasEnv.keymaps/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.hide/NylasEnv.hide/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getCurrentWindow/NylasEnv.getCurrentWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.menu/NylasEnv.menu/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getConfigDirPath/NylasEnv.getConfigDirPath/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.isMainWindow/NylasEnv.isMainWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.finishUnload/NylasEnv.finishUnload/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.isWorkWindow/NylasEnv.isWorkWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.showSaveDialog/NylasEnv.showSaveDialog/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.append/NylasEnv.append/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.confirm/NylasEnv.confirm/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.clipboard/NylasEnv.clipboard/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getVersion/NylasEnv.getVersion/g' More atom renaming Rename atom methods More atom methods Fix grunt config variable Change atom.cmd to N1.cmd Rename atom.coffee and atom.js to nylas-env.coffee nylas-env.js Fix atom global reference in specs manually Fix atom requires Change engine from atom to nylas got rid of global/nylas-env rename to nylas-win-bootup Fix onWindowPropsChanged to onWindowPropsReceived fix nylas-workspace atom-text-editor to nylas-theme-wrap atom-text-editor -> nylas-theme-wrap Replacing atom keyword AtomWindow -> NylasWindow Replace Atom -> N1 Rename atom items nylas.asar -> atom.asar Remove more atom references Remove 6to5 references Remove license exception for atom
2015-11-12 02:25:11 +08:00
defaultReplyType = NylasEnv.config.get('core.sending.defaultReplyType')
lastMessage = @_lastMessage()
return 'reply' unless lastMessage
if lastMessage.canReplyAll()
if defaultReplyType is 'reply-all'
return 'reply-all'
else
return 'reply'
else
return 'reply'
_onToggleAllMessagesExpanded: ->
Actions.toggleAllMessagesExpanded()
_onPrintThread: =>
node = ReactDOM.findDOMNode(@)
Actions.printThread(@state.currentThread, node.innerHTML)
_onPopThreadIn: =>
return unless @state.currentThread
Actions.focusThreadMainWindow(@state.currentThread)
NylasEnv.close()
_onPopoutThread: =>
return unless @state.currentThread
Actions.popoutThread(@state.currentThread)
# This returns the single-pane view to the inbox, and does nothing for
# double-pane view because we're at the root sheet.
Actions.popSheet()
_onClickReplyArea: =>
return unless @state.currentThread
Actions.composeReply({
thread: @state.currentThread,
message: @_lastMessage(),
type: @_replyType(),
behavior: 'prefer-existing-if-pristine',
})
_messageElements: =>
elements = []
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
hasReplyArea = not _.last(@state.messages)?.draft
messages = @_messagesWithMinification(@state.messages)
messages.forEach (message, idx) =>
if message.type is "minifiedBundle"
elements.push(@_renderMinifiedBundle(message))
return
collapsed = !@state.messagesExpandedState[message.id]
isLastMsg = (messages.length - 1 is idx)
isBeforeReplyArea = isLastMsg and hasReplyArea
elements.push(
<MessageItemContainer
key={message.clientId}
ref={"message-container-#{message.clientId}"}
thread={@state.currentThread}
message={message}
messages={@state.messages}
collapsed={collapsed}
isLastMsg={isLastMsg}
isBeforeReplyArea={isBeforeReplyArea}
scrollTo={@_scrollTo}
/>
)
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
if hasReplyArea
elements.push(@_renderReplyArea())
return elements
_renderMinifiedBundle: (bundle) ->
BUNDLE_HEIGHT = 36
lines = bundle.messages[0...10]
h = Math.round(BUNDLE_HEIGHT / lines.length)
<div className="minified-bundle"
onClick={ => @setState minified: false }
key={Utils.generateTempId()}>
<div className="num-messages">{bundle.messages.length} older messages</div>
<div className="msg-lines" style={height: h*lines.length}>
{lines.map (msg, i) ->
<div key={msg.id} style={height: h*2, top: -h*i} className="msg-line"></div>}
</div>
</div>
_messagesWithMinification: (messages=[]) =>
return messages unless @state.minified
messages = _.clone(messages)
minifyRanges = []
consecutiveCollapsed = 0
messages.forEach (message, idx) =>
return if idx is 0 # Never minify the 1st message
expandState = @state.messagesExpandedState[message.id]
if not expandState
consecutiveCollapsed += 1
else
# We add a +1 because we don't minify the last collapsed message,
# but the MINIFY_THRESHOLD refers to the smallest N that can be in
# the "N older messages" minified block.
if expandState is "default"
minifyOffset = 1
else # if expandState is "explicit"
minifyOffset = 0
if consecutiveCollapsed >= @MINIFY_THRESHOLD + minifyOffset
minifyRanges.push
start: idx - consecutiveCollapsed
length: (consecutiveCollapsed - minifyOffset)
consecutiveCollapsed = 0
indexOffset = 0
for range in minifyRanges
start = range.start - indexOffset
minified =
type: "minifiedBundle"
messages: messages[start...(start+range.length)]
messages.splice(start, range.length, minified)
# While we removed `range.length` items, we also added 1 back in.
indexOffset += (range.length - 1)
return messages
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
fix(draft-speed): Optimize draft creation and reduce scroll / focus delays Summary: This diff attempts to improve the responsiveness of the app when you hit "Reply". This is achieved by being smarter about creating the draft and loading it into the draft store, and also by allowing the compose* actions to take objects instead of just IDs (resulting in a fetch of the object). Allow Actions.composeReply,etc. to optionally be called with thread and message objects instead of IDs. This prevents a database lookup and the data is "right there." Create DraftStoreProxy for new drafts optimistically—this allows us to hand it the draft model we just created and it doesn't have to go query for it When we create a new Draft, immediately bind it to a LocalId. This means that when the MessageStore receives the trigger() event from the Database, it doesn't have to wait while a localId is created When MessageStore sees a new Message come in which is on the current thread, a draft, and not in the localIds map, assume it's a new draft and shortcut fetchFromCaceh to manually add it to the items array and display. This means the user sees the... ...draft instantly. Remove delays from focusing draft, scrolling to draft after content is ready. I actually removed these thinking it would break something, and it didn't break anything.... Maybe new Chromium handles better? Fix specs Test Plan: Run specs - more in progress right now Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1598
2015-06-06 02:38:30 +08:00
# Some child components (like the composer) might request that we scroll
# to a given location. If `selectionTop` is defined that means we should
# scroll to that absolute position.
#
# If messageId and location are defined, that means we want to scroll
# smoothly to the top of a particular message.
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-19 03:03:58 +08:00
_scrollTo: ({clientId, rect, position}={}) =>
return if @_draftScrollInProgress
if clientId
messageElement = @_getMessageContainer(clientId)
return unless messageElement
pos = position ? ScrollRegion.ScrollPosition.Visible
@refs.messageWrap.scrollTo(messageElement, {
position: pos
})
else if rect
@refs.messageWrap.scrollToRect(rect, {
position: ScrollRegion.ScrollPosition.CenterIfInvisible
})
else
throw new Error("onChildScrollRequest: expected clientId or rect")
_onScrollByPage: (direction) =>
height = ReactDOM.findDOMNode(@refs.messageWrap).clientHeight
@refs.messageWrap.scrollTop += height * direction
_onChange: =>
newState = @_getStateFromStores()
if @state.currentThread?.id isnt newState.currentThread?.id
newState.minified = true
@setState(newState)
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
_getStateFromStores: =>
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
messages: (MessageStore.items() ? [])
messagesExpandedState: MessageStore.itemsExpandedState()
canCollapse: MessageStore.items().length > 1
hasCollapsedItems: MessageStore.hasCollapsedItems()
currentThread: MessageStore.thread()
loading: MessageStore.itemsLoading()
module.exports = SearchableComponentMaker.extend(MessageList)