@@ -25,6 +25,7 @@ import type { GitStatus } from '../../git/models/status';
2525import type { GitWorktree } from '../../git/models/worktree' ;
2626import { getOpenedWorktreesByBranch , groupWorktreesByBranch } from '../../git/models/worktree' ;
2727import type { Subscription } from '../../plus/gk/account/subscription' ;
28+ import { isSubscriptionStatePaidOrTrial } from '../../plus/gk/account/subscription' ;
2829import type { SubscriptionChangeEvent } from '../../plus/gk/account/subscriptionService' ;
2930import { getLaunchpadSummary } from '../../plus/launchpad/utils' ;
3031import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol' ;
@@ -452,7 +453,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
452453 }
453454
454455 private async getState ( subscription ?: Subscription ) : Promise < State > {
455- const subResult = await this . getSubscription ( subscription ) ;
456+ const subResult = await this . getSubscriptionState ( subscription ) ;
456457
457458 return {
458459 ...this . host . baseWebviewState ,
@@ -505,7 +506,10 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
505506 branchesAndWorktrees ,
506507 this . container ,
507508 this . _overviewBranchFilter ,
508- forceWip ? { forceActive : true } : undefined ,
509+ {
510+ forceActive : forceWip ? true : undefined ,
511+ isPro : await this . isSubscriptionPro ( ) ,
512+ } ,
509513 ) ;
510514 this . _invalidateOverview = undefined ;
511515 if ( overviewBranches == null ) return undefined ;
@@ -684,8 +688,28 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
684688 return this . _hostedIntegrationConnected ;
685689 }
686690
691+ private _subscription : Subscription | undefined ;
687692 private async getSubscription ( subscription ?: Subscription ) {
688- subscription ??= await this . container . subscription . getSubscription ( true ) ;
693+ if ( subscription != null ) {
694+ this . _subscription = subscription ;
695+ } else if ( this . _subscription != null ) {
696+ subscription = this . _subscription ;
697+ } else {
698+ this . _subscription = subscription = await this . container . subscription . getSubscription ( true ) ;
699+ }
700+
701+ return this . _subscription ;
702+ }
703+
704+ private async isSubscriptionPro ( ) {
705+ const subscription = await this . getSubscription ( ) ;
706+ if ( subscription == null ) return false ;
707+
708+ return isSubscriptionStatePaidOrTrial ( subscription . state ) ;
709+ }
710+
711+ private async getSubscriptionState ( subscription ?: Subscription ) {
712+ subscription = await this . getSubscription ( subscription ) ;
689713
690714 let avatar ;
691715 if ( subscription . account ?. email ) {
@@ -756,7 +780,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
756780 }
757781
758782 private async notifyDidChangeSubscription ( subscription ?: Subscription ) {
759- const subResult = await this . getSubscription ( subscription ) ;
783+ const subResult = await this . getSubscriptionState ( subscription ) ;
760784
761785 void this . host . notify ( DidChangeSubscription , {
762786 subscription : subResult . subscription ,
@@ -903,7 +927,7 @@ async function getOverviewBranches(
903927 branchesData : RepositoryBranchData ,
904928 container : Container ,
905929 filters : OverviewFilters ,
906- options ?: { forceActive ?: boolean } ,
930+ options ?: { forceActive ?: boolean ; isPro ?: boolean } ,
907931) : Promise < GetOverviewBranches | undefined > {
908932 const { branches, worktreesByBranch } = branchesData ;
909933 if ( branches . length === 0 ) return undefined ;
@@ -930,8 +954,15 @@ async function getOverviewBranches(
930954 const timestamp = branch . date ?. getTime ( ) ;
931955 if ( branch . current || wt ?. opened ) {
932956 const forceOptions = options ?. forceActive ? { force : true } : undefined ;
933- prPromises . set ( branch . id , branch . getAssociatedPullRequest ( { avatarSize : 16 } ) ) ;
934- autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
957+ if ( options ?. isPro !== false ) {
958+ prPromises . set ( branch . id , branch . getAssociatedPullRequest ( { avatarSize : 16 } ) ) ;
959+ autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
960+ contributorPromises . set (
961+ branch . id ,
962+ container . git . getBranchContributorOverview ( branch . repoPath , branch . ref ) ,
963+ ) ;
964+ }
965+
935966 if ( wt != null ) {
936967 statusPromises . set ( branch . id , wt . getStatus ( forceOptions ) ) ;
937968 } else {
@@ -940,7 +971,6 @@ async function getOverviewBranches(
940971 }
941972 statusPromises . set ( branch . id , repoStatusPromise ) ;
942973 }
943- contributorPromises . set ( branch . id , container . git . getBranchContributorOverview ( branch . repoPath , branch . ref ) ) ;
944974
945975 overviewBranches . active . push ( {
946976 id : branch . id ,
@@ -957,12 +987,18 @@ async function getOverviewBranches(
957987 }
958988
959989 if ( timestamp != null && timestamp > recentThreshold ) {
960- prPromises . set ( branch . id , branch . getAssociatedPullRequest ( ) ) ;
961- autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
990+ if ( options ?. isPro !== false ) {
991+ prPromises . set ( branch . id , branch . getAssociatedPullRequest ( ) ) ;
992+ autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
993+ contributorPromises . set (
994+ branch . id ,
995+ container . git . getBranchContributorOverview ( branch . repoPath , branch . ref ) ,
996+ ) ;
997+ }
998+
962999 if ( wt != null ) {
9631000 statusPromises . set ( branch . id , wt . getStatus ( ) ) ;
9641001 }
965- contributorPromises . set ( branch . id , container . git . getBranchContributorOverview ( branch . repoPath , branch . ref ) ) ;
9661002
9671003 overviewBranches . recent . push ( {
9681004 id : branch . id ,
@@ -986,7 +1022,6 @@ async function getOverviewBranches(
9861022 orderBy : 'date:asc' ,
9871023 } ) ;
9881024 for ( const branch of branches ) {
989- autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
9901025 if ( overviewBranches . stale . length > 9 ) break ;
9911026
9921027 if (
@@ -996,23 +1031,27 @@ async function getOverviewBranches(
9961031 continue ;
9971032 }
9981033
1034+ if ( options ?. isPro !== false ) {
1035+ autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
1036+ }
1037+
9991038 const timestamp = branch . date ?. getTime ( ) ;
10001039 if ( branch . upstream ?. missing || ( timestamp != null && timestamp < staleThreshold ) ) {
10011040 const wt = worktreesByBranch . get ( branch . id ) ;
10021041 const worktree : GetOverviewBranch [ 'worktree' ] = wt
10031042 ? { name : wt . name , uri : wt . uri . toString ( ) }
10041043 : undefined ;
10051044
1006- if ( ! branch . upstream ?. missing ) {
1045+ if ( options ?. isPro !== false && ! branch . upstream ?. missing ) {
10071046 prPromises . set ( branch . id , branch . getAssociatedPullRequest ( ) ) ;
1047+ contributorPromises . set (
1048+ branch . id ,
1049+ container . git . getBranchContributorOverview ( branch . repoPath , branch . ref ) ,
1050+ ) ;
10081051 }
10091052 if ( wt != null ) {
10101053 statusPromises . set ( branch . id , wt . getStatus ( ) ) ;
10111054 }
1012- contributorPromises . set (
1013- branch . id ,
1014- container . git . getBranchContributorOverview ( branch . repoPath , branch . ref ) ,
1015- ) ;
10161055
10171056 overviewBranches . stale . push ( {
10181057 id : branch . id ,
0 commit comments