diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index 3737ea0..bbe4089 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -26,7 +26,7 @@ import type { import { configuration } from '../../../configuration'; import { CoreGitConfiguration, GlyphChars, Schemes } from '../../../constants'; import type { Container } from '../../../container'; -import { Features, PlusFeatures } from '../../../features'; +import { Features } from '../../../features'; import { StashApplyError, StashApplyErrorReason, @@ -108,7 +108,6 @@ import { SearchPattern } from '../../../git/search'; import { LogCorrelationContext, Logger } from '../../../logger'; import { Messages } from '../../../messages'; import { WorkspaceStorageKeys } from '../../../storage'; -import { SubscriptionPlanId } from '../../../subscription'; import { countStringLength, filterMap } from '../../../system/array'; import { gate } from '../../../system/decorators/gate'; import { debug, log } from '../../../system/decorators/log'; @@ -404,36 +403,6 @@ export class LocalGitProvider implements GitProvider, Disposable { }; } - private _allowedFeatures = new Map>(); - async allows(feature: PlusFeatures, plan: SubscriptionPlanId, repoPath?: string): Promise { - if (plan === SubscriptionPlanId.Free) return false; - if (plan === SubscriptionPlanId.Pro) return true; - - if (repoPath == null) { - const repositories = [...this.container.git.getOpenRepositories(this.descriptor.id)]; - - for await (const result of fastestSettled(repositories.map(r => this.allows(feature, plan, r.path)))) { - if (result.status !== 'fulfilled' || !result.value) return false; - } - return true; - } - - let allowedByRepo = this._allowedFeatures.get(repoPath); - let allowed = allowedByRepo?.get(feature); - if (allowed != null) return allowed; - - allowed = GitProviderService.previewFeatures?.get(feature) - ? true - : (await this.visibility(repoPath)) !== RepositoryVisibility.Private; - if (allowedByRepo == null) { - allowedByRepo = new Map(); - this._allowedFeatures.set(repoPath, allowedByRepo); - } - - allowedByRepo.set(feature, allowed); - return allowed; - } - private _supportedFeatures = new Map(); async supports(feature: Features): Promise { let supported = this._supportedFeatures.get(feature); diff --git a/src/git/gitProvider.ts b/src/git/gitProvider.ts index 6867d05..0b83421 100644 --- a/src/git/gitProvider.ts +++ b/src/git/gitProvider.ts @@ -1,7 +1,6 @@ import { Disposable, Event, Range, TextDocument, Uri, WorkspaceFolder } from 'vscode'; import type { Commit, InputBox } from '../@types/vscode.git'; -import { Features, PlusFeatures } from '../features'; -import type { SubscriptionPlanId } from '../subscription'; +import { Features } from '../features'; import type { GitUri } from './gitUri'; import type { BranchSortOptions, @@ -116,7 +115,6 @@ export interface GitProvider extends Disposable { ): Repository; openRepositoryInitWatcher?(): RepositoryInitWatcher; - allows(feature: PlusFeatures, plan: SubscriptionPlanId, repoPath?: string): Promise; supports(feature: Features): Promise; visibility(repoPath: string): Promise; diff --git a/src/plus/github/githubGitProvider.ts b/src/plus/github/githubGitProvider.ts index b74dde2..2f25581 100644 --- a/src/plus/github/githubGitProvider.ts +++ b/src/plus/github/githubGitProvider.ts @@ -25,7 +25,7 @@ import { OpenVirtualRepositoryError, OpenVirtualRepositoryErrorReason, } from '../../errors'; -import { Features, PlusFeatures } from '../../features'; +import { Features } from '../../features'; import { GitProvider, GitProviderId, @@ -38,7 +38,6 @@ import { RepositoryVisibility, ScmRepository, } from '../../git/gitProvider'; -import { GitProviderService } from '../../git/gitProviderService'; import { GitUri } from '../../git/gitUri'; import { BranchSortOptions, @@ -82,12 +81,10 @@ import { RemoteProviderFactory, RemoteProviders } from '../../git/remotes/factor import { RemoteProvider, RichRemoteProvider } from '../../git/remotes/provider'; import { SearchPattern } from '../../git/search'; import { LogCorrelationContext, Logger } from '../../logger'; -import { SubscriptionPlanId } from '../../subscription'; import { gate } from '../../system/decorators/gate'; import { debug, log } from '../../system/decorators/log'; import { filterMap, some } from '../../system/iterable'; import { isAbsolute, isFolderGlob, maybeUri, normalizePath, relative } from '../../system/path'; -import { fastestSettled } from '../../system/promise'; import { CachedBlame, CachedLog, GitDocumentState } from '../../trackers/gitDocumentTracker'; import { TrackedDocument } from '../../trackers/trackedDocument'; import { getRemoteHubApi, GitHubAuthorityMetadata, Metadata, RemoteHubApi } from '../remotehub'; @@ -189,36 +186,6 @@ export class GitHubGitProvider implements GitProvider, Disposable { ); } - private _allowedFeatures = new Map>(); - async allows(feature: PlusFeatures, plan: SubscriptionPlanId, repoPath?: string): Promise { - if (plan === SubscriptionPlanId.Free) return false; - if (plan === SubscriptionPlanId.Pro) return true; - - if (repoPath == null) { - const repositories = [...this.container.git.getOpenRepositories(this.descriptor.id)]; - - for await (const result of fastestSettled(repositories.map(r => this.allows(feature, plan, r.path)))) { - if (result.status !== 'fulfilled' || !result.value) return false; - } - return true; - } - - let allowedByRepo = this._allowedFeatures.get(repoPath); - let allowed = allowedByRepo?.get(feature); - if (allowed != null) return allowed; - - allowed = GitProviderService.previewFeatures?.get(feature) - ? true - : (await this.visibility(repoPath)) === RepositoryVisibility.Public; - if (allowedByRepo == null) { - allowedByRepo = new Map(); - this._allowedFeatures.set(repoPath, allowedByRepo); - } - - allowedByRepo.set(feature, allowed); - return allowed; - } - // private _supportedFeatures = new Map(); async supports(feature: Features): Promise { // const supported = this._supportedFeatures.get(feature);