Fix subscription page for members of a group

For a member of a group LimitationsManager.userHasSubscriptionOrIsGroupMember
doesn't return any subscription, so when the controller tries to
access subscription.recurlySubscription_id there's an error.

SubscriptionViewModelBuilder already knows how to handle the case
in which the user is a member of a group but has not subscription
of their own, so guarding against the crash is enough to fix
the issue.
This commit is contained in:
Alberto Fernández Capel 2018-01-05 15:01:53 +00:00
parent 626e0a16ef
commit 79eddcc736

View file

@ -97,7 +97,7 @@ module.exports = SubscriptionController =
logger.log user: user, "redirecting to plans"
res.redirect "/user/subscription/plans"
else
RecurlyWrapper.getSubscription subscription.recurlySubscription_id,
RecurlyWrapper.getSubscription subscription?.recurlySubscription_id,
includeAccount: true,
(err, usersSubscription)->
# always render the page, but skip the recurly link if