make sure we splice the sessions if they have the same set of scopes for github authentication

This commit is contained in:
Tyler Leonhardt 2021-09-23 16:46:23 -07:00
parent 0756643874
commit ab184912e6
No known key found for this signature in database
GPG key ID: 1BC2B6244363E77E

View file

@ -195,12 +195,13 @@ export class GitHubAuthenticationProvider implements vscode.AuthenticationProvid
scopes: JSON.stringify(scopes),
});
const token = await this._githubServer.login(scopes.join(' '));
const scopeString = scopes.join(' ');
const token = await this._githubServer.login(scopeString);
this.afterTokenLoad(token);
const session = await this.tokenToSession(token, scopes);
const sessions = await this._sessionsPromise;
const sessionIndex = sessions.findIndex(s => s.id === session.id);
const sessionIndex = sessions.findIndex(s => s.id === session.id || s.scopes.join(' ') === scopeString);
if (sessionIndex > -1) {
sessions.splice(sessionIndex, 1, session);
} else {