Skip to content

Commit c3c51d8

Browse files
committed
fix(quota-webview): Hide view when unauthenticated
1 parent af61623 commit c3c51d8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
"type": "webview",
8787
"id": "gitguardianQuotaView",
8888
"name": "quota",
89-
"collapsed": true
89+
"collapsed": true,
90+
"when": "isAuthenticated == true"
9091
}
9192
]
9293
},

src/extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function registerQuotaViewCommands(view: GitGuardianQuotaWebviewProvider) {
120120

121121
export function activate(context: ExtensionContext) {
122122
// Check if ggshield if available
123+
commands.executeCommand('setContext', 'isAuthenticated', false);
123124
const outputChannel = window.createOutputChannel("GGShield Resolver");
124125
let configuration = createDefaultConfiguration(context);
125126
let authStatus: boolean = false;
@@ -163,7 +164,9 @@ export function activate(context: ExtensionContext) {
163164
authStatus = ggshieldAuthStatus(configuration);
164165
if (!authStatus) {
165166
updateStatusBarItem(StatusBarStatus.unauthenticated, statusBar);
166-
}
167+
} else {
168+
commands.executeCommand('setContext', 'isAuthenticated', true);
169+
}
167170
})
168171
.then(async () => {
169172
// Check if git is installed
@@ -229,6 +232,7 @@ export function activate(context: ExtensionContext) {
229232
if (isAuthenticated) {
230233
authStatus = true;
231234
updateStatusBarItem(StatusBarStatus.ready, statusBar);
235+
commands.executeCommand('setContext', 'isAuthenticated', true);
232236
ggshieldViewProvider.refresh();
233237
ggshieldQuotaViewProvider.refresh();
234238
} else {

0 commit comments

Comments
 (0)