fix(composer): Always open new composer windows from the main window so that AccountStore.current() is correct

Fixes T3479
This commit is contained in:
Ben Gotow 2015-09-10 11:16:42 -07:00
parent 47a891b48c
commit 257540f2b4
3 changed files with 4 additions and 4 deletions

View file

@ -202,7 +202,7 @@ class Atom extends Model
# up into the browser process. This prevents us from needing this crap, which has to be
# updated every time a new application: command is added:
# https://github.com/atom/atom/blob/master/src/workspace-element.coffee#L119
if event.binding.command.indexOf('application:') is 0 and event.binding.selector is "body"
if event.binding.command.indexOf('application:') is 0 and event.binding.selector.indexOf("body") is 0
ipc.send('command', event.binding.command)
unless @inSpecMode()

View file

@ -254,6 +254,7 @@ class Application
atomWindow ?= @windowManager.focusedWindow()
atomWindow?.browserWindow.inspectElement(x, y)
@on 'application:new-message', => @windowManager.sendToMainWindow('new-message')
@on 'application:send-feedback', => @windowManager.sendToMainWindow('send-feedback')
@on 'application:open-preferences', => @windowManager.sendToMainWindow('open-preferences')
@on 'application:show-main-window', => @openWindowsForTokenState()

View file

@ -55,8 +55,8 @@ class DraftStore
@listenTo Actions.composeNewBlankDraft, @_onPopoutBlankDraft
@listenTo Actions.draftSendingFailed, @_onDraftSendingFailed
atom.commands.add 'body',
'application:new-message': => @_onPopoutBlankDraft()
if atom.isMainWindow()
ipc.on 'new-message', => @_onPopoutBlankDraft()
# Remember that these two actions only fire in the current window and
# are picked up by the instance of the DraftStore in the current
@ -92,7 +92,6 @@ class DraftStore
ipc.on 'mailto', @_onHandleMailtoLink
ipc.on 'inline-styles-result', @_onInlineStylesResult
# TODO: Doesn't work if we do window.addEventListener, but this is