about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorMatthias Einwag <matthias.einwag@live.com>2020-09-23 01:03:34 -0700
committerMatthias Einwag <matthias.einwag@live.com>2020-09-23 01:03:34 -0700
commit145bd6f70138246b4e5efebcd94786f147ac9e7a (patch)
tree120e380da28da851bc4ad632a009b4d14ccc1b65 /editors/code/src
parent501b516db4a9a50c39e2fb90b389d77c9541e43f (diff)
downloadrust-145bd6f70138246b4e5efebcd94786f147ac9e7a.tar.gz
rust-145bd6f70138246b4e5efebcd94786f147ac9e7a.zip
Fix clearing the token
The previous version would have interpreted an empty token as
an abort of the dialog and would have not properly cleared the token.
This is now fixed by checking for `undefined` for a an abort and
by setting the token to `undefined` in order to clear it.
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/main.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 2fcd853d444..ce7c56d05a8 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -393,8 +393,13 @@ async function queryForGithubToken(state: PersistentState): Promise<void> {
     };
 
     const newToken = await vscode.window.showInputBox(githubTokenOptions);
-    if (newToken) {
-        log.info("Storing new github token");
-        await state.updateGithubToken(newToken);
+    if (newToken !== undefined) {
+        if (newToken === "") {
+            log.info("Clearing github token");
+            await state.updateGithubToken(undefined);
+        } else {
+            log.info("Storing new github token");
+            await state.updateGithubToken(newToken);
+        }
     }
 }