mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #534 from sharelatex/ho-group-plan-redirect
null check subscription for group admin panel
This commit is contained in:
commit
04c3e4340d
2 changed files with 12 additions and 3 deletions
|
@ -54,8 +54,8 @@ module.exports =
|
||||||
renderSubscriptionGroupAdminPage: (req, res)->
|
renderSubscriptionGroupAdminPage: (req, res)->
|
||||||
user_id = AuthenticationController.getLoggedInUserId(req)
|
user_id = AuthenticationController.getLoggedInUserId(req)
|
||||||
SubscriptionLocator.getUsersSubscription user_id, (err, subscription)->
|
SubscriptionLocator.getUsersSubscription user_id, (err, subscription)->
|
||||||
if !subscription.groupPlan
|
if !subscription?.groupPlan
|
||||||
return res.redirect("/")
|
return res.redirect("/user/subscription")
|
||||||
SubscriptionGroupHandler.getPopulatedListOfMembers user_id, (err, users)->
|
SubscriptionGroupHandler.getPopulatedListOfMembers user_id, (err, users)->
|
||||||
res.render "subscriptions/group_admin",
|
res.render "subscriptions/group_admin",
|
||||||
title: 'group_admin'
|
title: 'group_admin'
|
||||||
|
|
|
@ -96,7 +96,16 @@ describe "SubscriptionGroupController", ->
|
||||||
|
|
||||||
res =
|
res =
|
||||||
redirect : (path)=>
|
redirect : (path)=>
|
||||||
path.should.equal("/")
|
path.should.equal("/user/subscription")
|
||||||
|
done()
|
||||||
|
@Controller.renderSubscriptionGroupAdminPage @req, res
|
||||||
|
|
||||||
|
it "should redirect you don't have a subscription", (done)->
|
||||||
|
@SubscriptionLocator.getUsersSubscription = sinon.stub().callsArgWith(1)
|
||||||
|
|
||||||
|
res =
|
||||||
|
redirect : (path)=>
|
||||||
|
path.should.equal("/user/subscription")
|
||||||
done()
|
done()
|
||||||
@Controller.renderSubscriptionGroupAdminPage @req, res
|
@Controller.renderSubscriptionGroupAdminPage @req, res
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue