Mailspring/internal_packages/composer-signature/lib/signature-composer-extension.coffee
Juan Tejada 579d4ad71b fix(signature): Update signature when account is changed in composer
Summary:
- Fixes #1239
- Adds action in composer view to indicate when draft partcipants have
  changed. This seemed like the simplest way to listen for this change without
  adding another extension point
- Updates signature plugin to listen to this action and update signature
  accordingly
- Adds test

Test Plan: - Unit tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2614
2016-02-24 00:19:55 -08:00

12 lines
450 B
CoffeeScript

{ComposerExtension, AccountStore} = require 'nylas-exports'
SignatureUtils = require './signature-utils'
class SignatureComposerExtension extends ComposerExtension
@prepareNewDraft: ({draft}) ->
accountId = draft.accountId
signature = NylasEnv.config.get("nylas.account-#{accountId}.signature")
return unless signature
draft.body = SignatureUtils.applySignature(draft.body, signature)
module.exports = SignatureComposerExtension