mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 12:33:35 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user