mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Send Email on Subscription Reactivation (#1721)
Send Email on Subscription Reactivation GitOrigin-RevId: 388f3490eddba0507e8c66e45d9ee4d185119c1e
This commit is contained in:
parent
54186d9db1
commit
2a73d8106b
3 changed files with 16 additions and 0 deletions
|
@ -80,6 +80,15 @@ I'm sorry to see you cancelled your #{settings.appName} premium account. Would y
|
|||
ctaURL: (opts) -> "https://docs.google.com/forms/d/e/1FAIpQLScqU6Je1r4Afz6ul6oY0RAfN7RabdWv_oL1u7Rj1YBmXS4fiQ/viewform?usp=sf_link"
|
||||
})
|
||||
|
||||
templates.reactivatedSubscription = CTAEmailTemplate({
|
||||
subject: () -> "Subscription Reactivated - #{settings.appName}"
|
||||
message: (opts) -> """
|
||||
Your subscription was reactivated successfully.
|
||||
"""
|
||||
ctaText: () -> "View Subscription Dashboard"
|
||||
ctaURL: (opts) -> "#{settings.siteUrl}/user/subscription"
|
||||
})
|
||||
|
||||
templates.passwordResetRequested = CTAEmailTemplate({
|
||||
subject: () -> "Password Reset - #{settings.appName}"
|
||||
title: () -> "Password Reset"
|
||||
|
|
|
@ -77,6 +77,8 @@ module.exports =
|
|||
if hasSubscription
|
||||
RecurlyWrapper.reactivateSubscription subscription.recurlySubscription_id, (error) ->
|
||||
return callback(error) if error?
|
||||
EmailHandler.sendEmail "reactivatedSubscription", to: user.email
|
||||
Analytics.recordEvent user._id, "subscription-reactivated"
|
||||
callback()
|
||||
else
|
||||
callback()
|
||||
|
|
|
@ -185,6 +185,9 @@ describe "SubscriptionHandler", ->
|
|||
it "should redirect to the subscription dashboard", ->
|
||||
@RecurlyWrapper.reactivateSubscription.called.should.equal false
|
||||
|
||||
it "should not send a notification email", ->
|
||||
sinon.assert.notCalled(@EmailHandler.sendEmail)
|
||||
|
||||
describe "with a user with a subscription", ->
|
||||
beforeEach (done) ->
|
||||
@LimitationsManager.userHasV2Subscription.callsArgWith(1, null, true, @subscription)
|
||||
|
@ -194,6 +197,8 @@ describe "SubscriptionHandler", ->
|
|||
@RecurlyWrapper.reactivateSubscription.called.should.equal true
|
||||
@RecurlyWrapper.reactivateSubscription.calledWith(@subscription.recurlySubscription_id).should.equal true
|
||||
|
||||
it "should send a notification email", ->
|
||||
sinon.assert.calledWith(@EmailHandler.sendEmail, 'reactivatedSubscription')
|
||||
|
||||
describe "recurlyCallback", ->
|
||||
describe "with an actionable request", ->
|
||||
|
|
Loading…
Reference in a new issue