diff --git a/internal_packages/message-list/lib/message-participants.cjsx b/internal_packages/message-list/lib/message-participants.cjsx index a2343812d..82db13f21 100644 --- a/internal_packages/message-list/lib/message-participants.cjsx +++ b/internal_packages/message-list/lib/message-participants.cjsx @@ -1,7 +1,8 @@ _ = require 'underscore' React = require "react" classnames = require 'classnames' -{Contact} = require 'nylas-exports' +{Actions, Contact} = require 'nylas-exports' +{Menu, MenuItem} = require('electron').remote MAX_COLLAPSED = 5 @@ -47,6 +48,15 @@ class MessageParticipants extends React.Component names.push("and #{extra} more") names.join(", ") + _onContactContextMenu: (contact) => + menu = new Menu() + menu.append(new MenuItem({role: 'copy'})) + menu.append(new MenuItem({ + label: "Email #{contact.email}", + click: => Actions.composeNewDraftToRecipient(contact) + })) + menu.popup(NylasEnv.getCurrentWindow()) + # Renderers _renderFullContacts: (contacts = []) => @@ -61,13 +71,26 @@ class MessageParticipants extends React.Component {c.fullName()}
- {"<"}{c.email}{">#{comma}"} + {"<"} + @_onContactContextMenu(c)} + > + {c.email} + + {">#{comma}"}
else
- {c.email}{comma} + @_onContactContextMenu(c)} + > + {c.email} + + {comma}
) diff --git a/src/flux/actions.coffee b/src/flux/actions.coffee index 6f0395159..d807ae4f8 100644 --- a/src/flux/actions.coffee +++ b/src/flux/actions.coffee @@ -360,6 +360,17 @@ class Actions ### @composeNewBlankDraft: ActionScopeWindow + ### + Public: Open a new composer window for a new draft addressed to the given recipient + + *Scope: Window* + + ``` + Actions.composeNewDraftToRecipient(contact) + ``` + ### + @composeNewDraftToRecipient: ActionScopeWindow + ### Public: Send the draft with the given ID. This Action is handled by the {DraftStore}, which finalizes the {DraftChangeSet} and allows {ComposerExtension}s to display diff --git a/src/flux/stores/draft-store.coffee b/src/flux/stores/draft-store.coffee index a9a91230a..10d653f09 100644 --- a/src/flux/stores/draft-store.coffee +++ b/src/flux/stores/draft-store.coffee @@ -54,6 +54,7 @@ class DraftStore @listenTo Actions.composeForward, @_onComposeForward @listenTo Actions.composePopoutDraft, @_onPopoutDraftClientId @listenTo Actions.composeNewBlankDraft, @_onPopoutBlankDraft + @listenTo Actions.composeNewDraftToRecipient, @_onPopoutNewDraftToRecipient @listenTo Actions.sendDraftFailed, @_onSendDraftFailed @listenTo Actions.sendDraftSuccess, @_onSendDraftSuccess @listenTo Actions.sendQuickReply, @_onSendQuickReply @@ -266,6 +267,10 @@ class DraftStore _createSession: (clientId, draft) => @_draftSessions[clientId] = new DraftEditingSession(clientId, draft) + _onPopoutNewDraftToRecipient: (contact) => + DraftFactory.createDraft({to: [contact]}).then (draft) => + @_finalizeAndPersistNewMessage(draft, popout: true) + _onPopoutBlankDraft: => Actions.recordUserEvent("Draft Created", {type: "new"}) NylasEnv.perf.start("Popout Draft")