Browse Source

Fixes #1936 promise cycle when validating access

main
Eric Amodio 2 years ago
parent
commit
8fb535055b
2 changed files with 5 additions and 2 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +4
    -2
      src/git/gitProviderService.ts

+ 1
- 0
CHANGELOG.md View File

@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## Fixed ## Fixed
- Fixes [#1936](https://github.com/gitkraken/vscode-gitlens/issues/1936) - Broken repositories view
- Fixes [#1882](https://github.com/gitkraken/vscode-gitlens/issues/1882) - Blame annotations not showing anymore after update - Fixes [#1882](https://github.com/gitkraken/vscode-gitlens/issues/1882) - Blame annotations not showing anymore after update
- Fixes [#1787](https://github.com/gitkraken/vscode-gitlens/issues/1787) - Remove '-review' from Gerrit Remote reviewDomain() — thanks to [PR #1954](https://github.com/gitkraken/vscode-gitlens/pull/1954) by Felipe Santos ([@felipecrs](https://github.com/felipecrs)) - Fixes [#1787](https://github.com/gitkraken/vscode-gitlens/issues/1787) - Remove '-review' from Gerrit Remote reviewDomain() — thanks to [PR #1954](https://github.com/gitkraken/vscode-gitlens/pull/1954) by Felipe Santos ([@felipecrs](https://github.com/felipecrs))
- Fixes [#1902](https://github.com/gitkraken/vscode-gitlens/issues/1902) - Support replacing mirror/replica domain with main domain for remote provider — thanks to [PR #1954](https://github.com/gitkraken/vscode-gitlens/pull/1954) by Felipe Santos ([@felipecrs](https://github.com/felipecrs)) - Fixes [#1902](https://github.com/gitkraken/vscode-gitlens/issues/1902) - Support replacing mirror/replica domain with main domain for remote provider — thanks to [PR #1954](https://github.com/gitkraken/vscode-gitlens/pull/1954) by Felipe Santos ([@felipecrs](https://github.com/felipecrs))

+ 4
- 2
src/git/gitProviderService.ts View File

@ -564,10 +564,11 @@ export class GitProviderService implements Disposable {
this: GitProviderService, this: GitProviderService,
repoPath: string | Uri, repoPath: string | Uri,
plan: FreeSubscriptionPlans, plan: FreeSubscriptionPlans,
force: boolean = false,
): Promise<FeatureAccess> { ): Promise<FeatureAccess> {
const { path: cacheKey } = this.getProvider(repoPath); const { path: cacheKey } = this.getProvider(repoPath);
let access = this._accessCache.get(cacheKey);
let access = force ? undefined : this._accessCache.get(cacheKey);
if (access == null) { if (access == null) {
access = this.visibility(repoPath).then(visibility => { access = this.visibility(repoPath).then(visibility => {
if (visibility !== RepositoryVisibility.Private) { if (visibility !== RepositoryVisibility.Private) {
@ -628,7 +629,8 @@ export class GitProviderService implements Disposable {
: { allowed: false, subscription: { current: subscription, required: requiredPlan } }; : { allowed: false, subscription: { current: subscription, required: requiredPlan } };
} }
return getRepoAccess.call(this, repoPath, plan);
// Pass force = true to bypass the cache and avoid a promise loop (where we used the cached promise we just created to try to resolve itself 🤦)
return getRepoAccess.call(this, repoPath, plan, true);
} }
async ensureAccess(feature: PlusFeatures, repoPath?: string): Promise<void> { async ensureAccess(feature: PlusFeatures, repoPath?: string): Promise<void> {

Loading…
Cancel
Save