Browse Source

Refreshes line annotations when auth changes

main
Eric Amodio 4 years ago
parent
commit
e3860e35e3
2 changed files with 13 additions and 3 deletions
  1. +2
    -1
      src/annotations/lineAnnotationController.ts
  2. +11
    -2
      src/git/remotes/provider.ts

+ 2
- 1
src/annotations/lineAnnotationController.ts View File

@ -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 View File

@ -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;

Loading…
Cancel
Save