Skip to content

Commit 83ab4ac

Browse files
Fixes command missing parameter and upgrade above pro
1 parent 6405c1f commit 83ab4ac

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/plus/gk/subscriptionService.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import {
8383
getPreviewSubscription,
8484
getSubscriptionPlan,
8585
getSubscriptionPlanName,
86+
getSubscriptionPlanPriority,
8687
getSubscriptionStateString,
8788
getSubscriptionTimeRemaining,
8889
getTimeRemaining,
@@ -355,7 +356,12 @@ export class SubscriptionService implements Disposable {
355356
registerCommand('gitlens.plus.startPreviewTrial', (src?: Source) => this.startPreviewTrial(src)),
356357
registerCommand('gitlens.plus.reactivateProTrial', (src?: Source) => this.reactivateProTrial(src)),
357358
registerCommand('gitlens.plus.resendVerification', (src?: Source) => this.resendVerification(src)),
358-
registerCommand('gitlens.plus.upgrade', (src?: Source) => this.upgrade(src)),
359+
registerCommand('gitlens.plus.upgrade', (srcAndPlan?: Source & { plan?: SubscriptionPlanId }) =>
360+
this.upgrade(
361+
srcAndPlan ? { source: srcAndPlan.source, detail: srcAndPlan.detail } : undefined,
362+
srcAndPlan?.plan,
363+
),
364+
),
359365

360366
registerCommand('gitlens.plus.hide', (src?: Source) => this.setProFeaturesVisibility(false, src)),
361367
registerCommand('gitlens.plus.restore', (src?: Source) => this.setProFeaturesVisibility(true, src)),
@@ -908,7 +914,11 @@ export class SubscriptionService implements Disposable {
908914
try {
909915
const session = await this.ensureSession(false, source);
910916
if (session != null) {
911-
if ((await this.checkUpdatedSubscription(source)) === SubscriptionState.Paid) {
917+
if (
918+
(await this.checkUpdatedSubscription(source)) === SubscriptionState.Paid &&
919+
getSubscriptionPlanPriority(this._subscription.plan.effective.id) >=
920+
getSubscriptionPlanPriority(plan ?? SubscriptionPlanId.Pro)
921+
) {
912922
return;
913923
}
914924
}

0 commit comments

Comments
 (0)