Merge pull request #1530 from sharelatex/spd-dont-cancel-groups-on-invite

Only prompt for group cancellation if group is personal when accepting invite

GitOrigin-RevId: 921807b25d64f037859d303e28c40cdc12eb7685
This commit is contained in:
Simon Detheridge 2019-02-25 10:24:33 +00:00 committed by James Allen
parent f84e94dc88
commit 5d8b8ff012
3 changed files with 15 additions and 3 deletions

View file

@ -37,10 +37,17 @@ module.exports =
SubscriptionLocator.getUsersSubscription userId, (err, personalSubscription) ->
return next(err) if err?
hasIndividualRecurlySubscription =
personalSubscription? &&
!personalSubscription.planCode.match(/(free|trial)/)? &&
personalSubscription.groupPlan == false &&
personalSubscription.recurlySubscription_id? &&
personalSubscription.recurlySubscription_id != ""
res.render "subscriptions/team/invite",
inviterName: invite.inviterName
inviteToken: invite.token
hasPersonalSubscription: personalSubscription?
hasIndividualRecurlySubscription: hasIndividualRecurlySubscription
appName: settings.appName
acceptInvite: (req, res, next) ->

View file

@ -20,8 +20,9 @@ block content
.page-header
h1.text-centered #{translate("invited_to_group", {inviterName: inviterName, appName: appName})}
div(ng-show="view =='personalSubscription'")
div(ng-show="view =='hasIndividualRecurlySubscription'")
p #{translate("cancel_personal_subscription_first")}
.alert.alert-danger(ng-show="cancel_error" ng-cloak) #{translate("something_went_wrong_canceling_your_subscription")}
p
a.btn.btn.btn-default(ng-click="keepPersonalSubscription()", ng-disabled="inflight") #{translate("not_now")}
|  

View file

@ -31,7 +31,11 @@ define(['base'], App =>
$scope.inflight = false
return ($scope.view = 'teamInvite')
})
return request.catch(() => console.log('the request failed'))
return request.catch(() => {
$scope.inflight = false
$scope.cancel_error = true
console.log('the request failed')
})
}
return ($scope.joinTeam = function() {