mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 06:03:32 +00: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)->
|
||||
user_id = AuthenticationController.getLoggedInUserId(req)
|
||||
SubscriptionLocator.getUsersSubscription user_id, (err, subscription)->
|
||||
if !subscription.groupPlan
|
||||
return res.redirect("/")
|
||||
if !subscription?.groupPlan
|
||||
return res.redirect("/user/subscription")
|
||||
SubscriptionGroupHandler.getPopulatedListOfMembers user_id, (err, users)->
|
||||
res.render "subscriptions/group_admin",
|
||||
title: 'group_admin'
|
||||
|
|
|
@ -96,7 +96,16 @@ describe "SubscriptionGroupController", ->
|
|||
|
||||
res =
|
||||
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()
|
||||
@Controller.renderSubscriptionGroupAdminPage @req, res
|
||||
|
||||
|
|
Loading…
Reference in a new issue