Skip to content

Commit

Permalink
fix(amazonq): sign-in notification displaying if user is signed in (a…
Browse files Browse the repository at this point in the history
…ws#5544)

Problem: `Start using Amazon Q` can display if there is some error
restoring the connection object in the main Auth class. May be a network
error or some other error. This is fine because Q uses secondary auth,
so it only needs to be restored in that class. However, the notification
logic access is in the Auth class which may not be restored.

Solution: Use AuthUtil to check if there is a connection instead of
Auth.

---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
  • Loading branch information
hayemaxi authored Sep 4, 2024
1 parent 57382ad commit faffcd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "UI: 'Start using Amazon Q' may display even if the user is signed in."
}
5 changes: 2 additions & 3 deletions packages/amazonq/src/app/chat/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import * as vscode from 'vscode'
import { ExtensionContext, window } from 'vscode'
import { Auth } from 'aws-core-vscode/auth'
import { telemetry } from 'aws-core-vscode/telemetry'
import { CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
import { AuthUtil, CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
import { Commands, placeholder, funcUtil } from 'aws-core-vscode/shared'
import * as amazonq from 'aws-core-vscode/amazonq'

Expand Down Expand Up @@ -81,7 +80,7 @@ async function setupAuthNotification() {

async function tryShowNotification() {
// Do not show the notification if the IDE starts and user is already authenticated.
if (Auth.instance.activeConnection) {
if (AuthUtil.instance.isConnected()) {
notificationDisplayed = true
}

Expand Down

0 comments on commit faffcd0

Please sign in to comment.