mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 03:13:41 -05:00
Merge pull request #17822 from overleaf/jel-dash-usersBestSubscription
[web] Limit data sent to dash for best subscription when group GitOrigin-RevId: d52101bec69cbb7931e9702e085b4aeb65d9d603
This commit is contained in:
parent
751e079105
commit
0cfcdf5e4d
2 changed files with 26 additions and 4 deletions
|
@ -404,10 +404,14 @@ async function getBestSubscription(user) {
|
|||
groupSubscription.planCode
|
||||
)
|
||||
if (_isPlanEqualOrBetter(plan, bestSubscription.plan)) {
|
||||
const groupDataForView = {}
|
||||
if (groupSubscription.teamName) {
|
||||
groupDataForView.teamName = groupSubscription.teamName
|
||||
}
|
||||
const remainingTrialDays = _getRemainingTrialDays(groupSubscription)
|
||||
bestSubscription = {
|
||||
type: 'group',
|
||||
subscription: groupSubscription,
|
||||
subscription: groupDataForView,
|
||||
plan,
|
||||
remainingTrialDays,
|
||||
}
|
||||
|
|
|
@ -269,7 +269,25 @@ describe('SubscriptionViewModelBuilder', function () {
|
|||
)
|
||||
assert.deepEqual(usersBestSubscription, {
|
||||
type: 'group',
|
||||
subscription: this.groupSubscription,
|
||||
subscription: {},
|
||||
plan: this.groupPlan,
|
||||
remainingTrialDays: -1,
|
||||
})
|
||||
})
|
||||
|
||||
it('should return a group subscription with team name when user has one', async function () {
|
||||
this.SubscriptionLocator.promises.getMemberSubscriptions
|
||||
.withArgs(this.user)
|
||||
.resolves([
|
||||
Object.assign({}, this.groupSubscription, { teamName: 'test team' }),
|
||||
])
|
||||
const usersBestSubscription =
|
||||
await this.SubscriptionViewModelBuilder.promises.getBestSubscription(
|
||||
this.user
|
||||
)
|
||||
assert.deepEqual(usersBestSubscription, {
|
||||
type: 'group',
|
||||
subscription: { teamName: 'test team' },
|
||||
plan: this.groupPlan,
|
||||
remainingTrialDays: -1,
|
||||
})
|
||||
|
@ -345,7 +363,7 @@ describe('SubscriptionViewModelBuilder', function () {
|
|||
|
||||
assert.deepEqual(usersBestSubscription, {
|
||||
type: 'group',
|
||||
subscription: this.groupSubscription,
|
||||
subscription: {},
|
||||
plan: this.groupPlan,
|
||||
remainingTrialDays: -1,
|
||||
})
|
||||
|
@ -434,7 +452,7 @@ describe('SubscriptionViewModelBuilder', function () {
|
|||
|
||||
assert.deepEqual(usersBestSubscription, {
|
||||
type: 'group',
|
||||
subscription: this.groupSubscription,
|
||||
subscription: {},
|
||||
plan: this.groupPlan,
|
||||
remainingTrialDays: -1,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue