diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index 3067c71..cb58f7a 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -534,11 +534,15 @@ export class GitProviderService implements Disposable { } if ( - access.visibility !== RepositoryVisibility.Private && - access.subscription.current.plan.effective.id === SubscriptionPlanId.Free + (access.visibility !== RepositoryVisibility.Private && + access.subscription.current.plan.effective.id === SubscriptionPlanId.Free) || + (access.visibility === RepositoryVisibility.Private && access.subscription.current.previewTrial == null) ) { return { - allowed: true, + allowed: !( + access.visibility === RepositoryVisibility.Private && + access.subscription.current.previewTrial == null + ), subscription: { current: access.subscription.current }, visibility: access.visibility, }; diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index 20425b4..c269cd1 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -407,7 +407,7 @@ export class GraphWebview extends WebviewBase { private async notifyDidChangeSubscription() { if (!this.isReady || !this.visible) return false; - const access = await this.container.git.access(PlusFeatures.Graph, this.repository?.path); + const access = await this.getGraphAccess(); return this.notify(DidChangeSubscriptionNotificationType, { subscription: access.subscription.current, allowed: access.allowed, @@ -465,14 +465,7 @@ export class GraphWebview extends WebviewBase { const limit = this._graph?.paging?.limit ?? config.defaultItemLimit; // Check for GitLens+ access - let access = await this.container.git.access(PlusFeatures.Graph, this.repository?.path); - this._etagSubscription = this.container.subscription.etag; - - // If we don't have access to GitLens+, but the preview trial hasn't been started, auto-start it - if (!access.allowed && access.subscription.current.previewTrial == null) { - await this.container.subscription.startPreviewTrial(true); - access = await this.container.git.access(PlusFeatures.Graph, this.repository?.path); - } + const access = await this.getGraphAccess(); const visibility = access.visibility ?? (await this.container.git.visibility(this.repository.path)); @@ -504,6 +497,18 @@ export class GraphWebview extends WebviewBase { }; } + private async getGraphAccess() { + let access = await this.container.git.access(PlusFeatures.Graph, this.repository?.path); + this._etagSubscription = this.container.subscription.etag; + + // If we don't have access to GitLens+, but the preview trial hasn't been started, auto-start it + if (!access.allowed && access.subscription.current.previewTrial == null) { + await this.container.subscription.startPreviewTrial(true); + access = await this.container.git.access(PlusFeatures.Graph, this.repository?.path); + } + return access; + } + private resetRepositoryState() { this.setGraph(undefined); this._selectedSha = undefined;