mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
Remove session if it is being replaced (#212504)
A bug that has probably existed for quite a while... if we are replacing a session, we should say the old session is removed.
This commit is contained in:
parent
bbc0159f43
commit
9d4274e559
|
@ -306,14 +306,15 @@ export class GitHubAuthenticationProvider implements vscode.AuthenticationProvid
|
||||||
this.afterSessionLoad(session);
|
this.afterSessionLoad(session);
|
||||||
|
|
||||||
const sessionIndex = sessions.findIndex(s => s.id === session.id || arrayEquals([...s.scopes].sort(), sortedScopes));
|
const sessionIndex = sessions.findIndex(s => s.id === session.id || arrayEquals([...s.scopes].sort(), sortedScopes));
|
||||||
|
const removed = new Array<vscode.AuthenticationSession>();
|
||||||
if (sessionIndex > -1) {
|
if (sessionIndex > -1) {
|
||||||
sessions.splice(sessionIndex, 1, session);
|
removed.push(...sessions.splice(sessionIndex, 1, session));
|
||||||
} else {
|
} else {
|
||||||
sessions.push(session);
|
sessions.push(session);
|
||||||
}
|
}
|
||||||
await this.storeSessions(sessions);
|
await this.storeSessions(sessions);
|
||||||
|
|
||||||
this._sessionChangeEmitter.fire({ added: [session], removed: [], changed: [] });
|
this._sessionChangeEmitter.fire({ added: [session], removed, changed: [] });
|
||||||
|
|
||||||
this._logger.info('Login success!');
|
this._logger.info('Login success!');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue