Kaynağa Gözat

Refreshes line annotations when auth changes

main
Eric Amodio 4 yıl önce
ebeveyn
işleme
e3860e35e3
2 değiştirilmiş dosya ile 13 ekleme ve 3 silme
  1. +2
    -1
      src/annotations/lineAnnotationController.ts
  2. +11
    -2
      src/git/remotes/provider.ts

+ 2
- 1
src/annotations/lineAnnotationController.ts Dosyayı Görüntüle

@ -13,7 +13,7 @@ import { Annotations } from './annotations';
import { configuration } from '../configuration';
import { GlyphChars, isTextEditor } from '../constants';
import { Container } from '../container';
import { CommitFormatter, GitBlameCommit, PullRequest } from '../git/git';
import { Authentication, CommitFormatter, GitBlameCommit, PullRequest } from '../git/git';
import { LogCorrelationContext, Logger } from '../logger';
import { debug, Iterables, log, Promises } from '../system';
import { LinesChangeEvent, LineSelection } from '../trackers/gitLineTracker';
@ -35,6 +35,7 @@ export class LineAnnotationController implements Disposable {
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
Container.fileAnnotations.onDidToggleAnnotations(this.onFileAnnotationsToggled, this),
Authentication.onDidChange(() => void this.refresh(window.activeTextEditor)),
);
this.onConfigurationChanged(configuration.initializingChangeEvent);
}

+ 11
- 2
src/git/remotes/provider.ts Dosyayı Görüntüle

@ -21,6 +21,14 @@ import { PullRequest } from '../models/pullRequest';
import { Repository } from '../models/repository';
import { debug, gate, Promises } from '../../system';
const _onDidChangeAuthentication = new EventEmitter<void>();
export class Authentication {
static get onDidChange(): Event<void> {
return _onDidChangeAuthentication.event;
}
}
export class AuthenticationError extends Error {
constructor(private original: Error) {
super(original.message);
@ -233,8 +241,7 @@ export abstract class RemoteProviderWithApi extends RemoteProvider {
private onAuthenticationSessionsChanged(e: AuthenticationSessionsChangeEvent) {
if (e.provider.id === this.authProvider.id) {
this._session = null;
this._onDidChange.fire();
this.disconnect();
}
}
@ -254,6 +261,7 @@ export abstract class RemoteProviderWithApi extends RemoteProvider {
this.invalidAuthenticationCount = 0;
this._session = null;
this._onDidChange.fire();
_onDidChangeAuthentication.fire();
}
@gate()
@ -343,6 +351,7 @@ export abstract class RemoteProviderWithApi extends RemoteProvider {
if (session != null) {
this._onDidChange.fire();
_onDidChangeAuthentication.fire();
}
return session ?? undefined;

Yükleniyor…
İptal
Kaydet