Skip to content

Commit

Permalink
fix outgoing email bug (#1147)
Browse files Browse the repository at this point in the history
* fix outgoing email bug

* update tests and add a different message
  • Loading branch information
asood123 authored Feb 21, 2018
1 parent c635085 commit 8cce1ae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions server/lib/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ export async function sendFailedEmail(order, lastAttempt) {
lastAttempt,
order: order.info,
collective: order.collective.info,
fromCollective: order.fromCollective.minimal
fromCollective: order.fromCollective.minimal,
subscriptionsLink: user.generateLoginLink(`/${order.fromCollective.slug}/subscriptions`)
}, {
from: `${order.collective.name} <hello@${order.collective.slug}.opencollective.com>`
});
Expand All @@ -208,7 +209,7 @@ export async function sendThankYouEmail(order, transaction) {
relatedCollectives,
config: { host: config.host },
interval: order.Subscription.interval,
subscriptionsLink: user.generateLoginLink(`/${order.fromCollective.slug}/subscriptions`),
subscriptionsLink: user.generateLoginLink(`/${order.fromCollective.slug}/subscriptions`)
}, {
from: `${order.collective.name} <hello@${order.collective.slug}.opencollective.com>`
});
Expand Down
2 changes: 2 additions & 0 deletions templates/emails/payment.failed.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Subject: Payment failed: Update your info to continue supporting {{collective.na

{{> toplogo}}

Update: Apologies for the earlier email with the missing link. This email contains the right link.

{{#if fromCollective.name}}
<p>Dear {{fromCollective.name}},</p>
{{else}}
Expand Down
1 change: 1 addition & 0 deletions templates/emails/payment.failed.text.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Subject: Payment failed: Subscription cancelled to {{collective.name}}
Subject: Payment failed: Update your info to continue supporting {{collective.name}}
{{/if}}

Update: Apologies for the earlier email with the missing link. This email contains the right link.

{{#if fromCollective.name}}
Dear {{fromCollective.name}},
Expand Down
6 changes: 4 additions & 2 deletions test/lib.subscriptions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ describe('LibSubscription', () => {
lastAttempt: false,
order: order.info,
collective: order.collective.info,
fromCollective: order.fromCollective.minimal
fromCollective: order.fromCollective.minimal,
subscriptionsLink: '/'
});

// When the status of the order is handled
Expand All @@ -272,7 +273,8 @@ describe('LibSubscription', () => {
lastAttempt: true,
order: order.info,
collective: order.collective.info,
fromCollective: order.fromCollective.minimal
fromCollective: order.fromCollective.minimal,
subscriptionsLink: '/'
});

// When the status of the order is handled
Expand Down

0 comments on commit 8cce1ae

Please sign in to comment.