diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index cb58f7a..7277096 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -24,7 +24,12 @@ import type { SubscriptionChangeEvent } from '../plus/subscription/subscriptionS import type { RepoComparisonKey } from '../repositories'; import { asRepoComparisonKey, Repositories } from '../repositories'; import type { FreeSubscriptionPlans, RequiredSubscriptionPlans, Subscription } from '../subscription'; -import { getSubscriptionPlanPriority, isSubscriptionPaidPlan, SubscriptionPlanId } from '../subscription'; +import { + getSubscriptionPlan, + getSubscriptionPlanPriority, + isSubscriptionPaidPlan, + SubscriptionPlanId, +} from '../subscription'; import { groupByFilterMap, groupByMap } from '../system/array'; import { gate } from '../system/decorators/gate'; import { debug, getLogScope, log } from '../system/decorators/log'; @@ -543,7 +548,15 @@ export class GitProviderService implements Disposable { access.visibility === RepositoryVisibility.Private && access.subscription.current.previewTrial == null ), - subscription: { current: access.subscription.current }, + subscription: { + current: { + ...access.subscription.current, + plan: { + ...access.subscription.current.plan, + effective: getSubscriptionPlan(SubscriptionPlanId.Pro, undefined), + }, + }, + }, visibility: access.visibility, }; } diff --git a/src/plus/subscription/subscriptionService.ts b/src/plus/subscription/subscriptionService.ts index 20b319b..b3a5f1f 100644 --- a/src/plus/subscription/subscriptionService.ts +++ b/src/plus/subscription/subscriptionService.ts @@ -776,16 +776,28 @@ export class SubscriptionService implements Disposable { // Check if the preview has expired, if not apply it if (subscription.previewTrial != null && (getTimeRemaining(subscription.previewTrial.expiresOn) ?? 0) > 0) { - (subscription.plan as PickMutable).effective = getSubscriptionPlan( - SubscriptionPlanId.Pro, - new Date(subscription.previewTrial.startedOn), - new Date(subscription.previewTrial.expiresOn), - ); + subscription = { + ...subscription, + plan: { + ...subscription.plan, + effective: getSubscriptionPlan( + SubscriptionPlanId.Pro, + new Date(subscription.previewTrial.startedOn), + new Date(subscription.previewTrial.expiresOn), + ), + }, + }; } // If the effective plan has expired, then replace it with the actual plan if (isSubscriptionExpired(subscription)) { - (subscription.plan as PickMutable).effective = subscription.plan.actual; + subscription = { + ...subscription, + plan: { + ...subscription.plan, + effective: subscription.plan.actual, + }, + }; } subscription.state = computeSubscriptionState(subscription);