Merge pull request #1724 from sharelatex/ta-subscription-canceled-page

Add Subscription Canceled Page

GitOrigin-RevId: b490ff008dd888911e8168606d90ae92662c0745
This commit is contained in:
Simon Detheridge
2019-04-25 14:37:15 +00:00
committed by sharelatex
parent 6c04bc8712
commit 3990a5d736
5 changed files with 27 additions and 3 deletions
@@ -159,7 +159,14 @@ module.exports = SubscriptionController =
if err?
logger.err err:err, user_id:user._id, "something went wrong canceling subscription"
return next(err)
res.redirect "/user/subscription"
# Note: this redirect isn't used in the main flow as the redirection is
# handled by Angular
res.redirect "/user/subscription/canceled"
canceledSubscription: (req, res, next)->
user = AuthenticationController.getSessionUser(req)
res.render "subscriptions/canceled_subscription",
title: "subscription_canceled"
cancelV1Subscription: (req, res, next) ->
user_id = AuthenticationController.getLoggedInUserId(req)
@@ -17,6 +17,8 @@ module.exports =
webRouter.get '/user/subscription/thank-you', AuthenticationController.requireLogin(), SubscriptionController.successful_subscription
webRouter.get '/user/subscription/canceled', AuthenticationController.requireLogin(), SubscriptionController.canceledSubscription
webRouter.get '/subscription/group', AuthenticationController.requireLogin(), SubscriptionGroupController.redirectToSubscriptionGroupAdminPage
webRouter.delete '/subscription/group/user', AuthenticationController.requireLogin(), SubscriptionGroupController.removeSelfFromGroup
@@ -0,0 +1,15 @@
extends ../layout
block content
.content.content-alt
.container
.row
.col-md-8.col-md-offset-2
.card(ng-cloak)
.page-header
h2 #{translate("subscription_canceled")}
.alert.alert-info
p #{translate("to_modify_your_subscription_go_to")}
a(href="/user/subscription") #{translate("manage_subscription")}.
p
a.btn.btn-primary(href="/project") < #{translate("back_to_your_projects")}
@@ -231,7 +231,7 @@ define(['base'], function(App) {
$scope.inflight = true
return $http
.post('/user/subscription/cancel', body)
.then(() => location.reload())
.then(() => (location.href = '/user/subscription/canceled'))
.catch(() => console.log('something went wrong changing plan'))
}
@@ -293,7 +293,7 @@ describe "SubscriptionController", ->
done()
it "should redurect to the subscription page", (done)->
@res.redirect.calledWith("/user/subscription").should.equal true
@res.redirect.calledWith("/user/subscription/canceled").should.equal true
done()
describe "recurly callback", ->