GitHub - fix an issue with toggling branch protection setting (#182536)

* GitHub - fix an issue with toggling branch protection setting

* 💄 Remove variable

* Pull request feedback
This commit is contained in:
Ladislau Szomoru
2023-05-15 21:03:27 +02:00
committed by GitHub
parent 367899f5d2
commit b7be44e639
2 changed files with 8 additions and 6 deletions

View File

@@ -152,7 +152,7 @@ export class Model implements IBranchProtectionProviderRegistry, IRemoteSourcePu
private _onDidChangePostCommitCommandsProviders = new EventEmitter<void>();
readonly onDidChangePostCommitCommandsProviders = this._onDidChangePostCommitCommandsProviders.event;
private branchProtectionProviders = new Map<Uri, Set<BranchProtectionProvider>>();
private branchProtectionProviders = new Map<string, Set<BranchProtectionProvider>>();
private _onDidChangeBranchProtectionProviders = new EventEmitter<Uri>();
readonly onDidChangeBranchProtectionProviders = this._onDidChangeBranchProtectionProviders.event;
@@ -769,17 +769,17 @@ export class Model implements IBranchProtectionProviderRegistry, IRemoteSourcePu
registerBranchProtectionProvider(root: Uri, provider: BranchProtectionProvider): Disposable {
const providerDisposables: Disposable[] = [];
this.branchProtectionProviders.set(root, (this.branchProtectionProviders.get(root) ?? new Set()).add(provider));
this.branchProtectionProviders.set(root.toString(), (this.branchProtectionProviders.get(root.toString()) ?? new Set()).add(provider));
providerDisposables.push(provider.onDidChangeBranchProtection(uri => this._onDidChangeBranchProtectionProviders.fire(uri)));
this._onDidChangeBranchProtectionProviders.fire(root);
return toDisposable(() => {
const providers = this.branchProtectionProviders.get(root);
const providers = this.branchProtectionProviders.get(root.toString());
if (providers && providers.has(provider)) {
providers.delete(provider);
this.branchProtectionProviders.set(root, providers);
this.branchProtectionProviders.set(root.toString(), providers);
this._onDidChangeBranchProtectionProviders.fire(root);
}
@@ -788,7 +788,7 @@ export class Model implements IBranchProtectionProviderRegistry, IRemoteSourcePu
}
getBranchProtectionProviders(root: Uri): BranchProtectionProvider[] {
return [...(this.branchProtectionProviders.get(root) ?? new Set()).values()];
return [...(this.branchProtectionProviders.get(root.toString()) ?? new Set()).values()];
}
registerPostCommitCommandsProvider(provider: PostCommitCommandsProvider): Disposable {