Skip to content

Commit a75ad3e

Browse files
committed
Adding f/b for internal amazon users only.
1 parent 6b71955 commit a75ad3e

File tree

2 files changed

+33
-35
lines changed

2 files changed

+33
-35
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import software.aws.toolkits.core.utils.debug
2929
import software.aws.toolkits.core.utils.error
3030
import software.aws.toolkits.core.utils.getLogger
3131
import software.aws.toolkits.core.utils.info
32+
import software.aws.toolkits.jetbrains.core.credentials.sono.isInternalUser
3233
import software.aws.toolkits.jetbrains.services.amazonq.clients.AmazonQStreamingClient
3334
import software.aws.toolkits.jetbrains.services.amazonqCodeTest.controller.CodeTestChatHelper
3435
import software.aws.toolkits.jetbrains.services.amazonqCodeTest.messages.Button
@@ -560,16 +561,18 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
560561
else -> message("testgen.error.generic_error_message")
561562
}
562563
val buttonList = mutableListOf<Button>()
563-
buttonList.add(
564-
Button(
565-
"utg_feedback",
566-
message("testgen.button.feedback"),
567-
keepCardAfterClick = true,
568-
position = "outside",
569-
status = "info",
570-
icon = "comment"
571-
),
572-
)
564+
if (isInternalUser(getStartUrl(project))) {
565+
buttonList.add(
566+
Button(
567+
"utg_feedback",
568+
message("testgen.button.feedback"),
569+
keepCardAfterClick = true,
570+
position = "outside",
571+
status = "info",
572+
icon = "comment"
573+
),
574+
)
575+
}
573576
codeTestChatHelper.addAnswer(
574577
CodeTestChatMessageContent(
575578
message = errorMessage,

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import software.aws.toolkits.jetbrains.core.AwsClientManager
5454
import software.aws.toolkits.jetbrains.core.coroutines.EDT
5555
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager
5656
import software.aws.toolkits.jetbrains.core.credentials.pinning.QConnection
57+
import software.aws.toolkits.jetbrains.core.credentials.sono.isInternalUser
5758
import software.aws.toolkits.jetbrains.services.amazonq.apps.AmazonQAppInitContext
5859
import software.aws.toolkits.jetbrains.services.amazonq.auth.AuthController
5960
import software.aws.toolkits.jetbrains.services.amazonq.project.RelevantDocument
@@ -690,23 +691,12 @@ class CodeTestChatController(
690691
requestId = session.startTestGenerationRequestId,
691692
status = Status.ACCEPTED,
692693
)
693-
val buttonList = mutableListOf<Button>()
694-
buttonList.add(
695-
Button(
696-
"utg_feedback",
697-
message("testgen.button.feedback"),
698-
keepCardAfterClick = true,
699-
position = "outside",
700-
status = "info",
701-
icon = "comment"
702-
),
703-
)
704694
codeTestChatHelper.addAnswer(
705695
CodeTestChatMessageContent(
706696
message = message("testgen.message.success"),
707697
type = ChatMessageType.Answer,
708698
canBeVoted = false,
709-
buttons = buttonList
699+
buttons = this.showFeedbackButton()
710700
)
711701
)
712702
codeTestChatHelper.updateUI(
@@ -850,24 +840,12 @@ class CodeTestChatController(
850840
ApplicationManager.getApplication().invokeLater {
851841
session.openedDiffFile?.let { FileEditorManager.getInstance(context.project).closeFile(it) }
852842
}
853-
val buttonList = mutableListOf<Button>()
854-
buttonList.add(
855-
Button(
856-
"utg_feedback",
857-
message("testgen.button.feedback"),
858-
keepCardAfterClick = true,
859-
position = "outside",
860-
status = "info",
861-
disabled = true,
862-
icon = "comment"
863-
),
864-
)
865843
codeTestChatHelper.addAnswer(
866844
CodeTestChatMessageContent(
867845
message = message("testgen.message.success"),
868846
type = ChatMessageType.Answer,
869847
canBeVoted = false,
870-
buttons = buttonList
848+
buttons = this.showFeedbackButton()
871849
)
872850
)
873851
val testGenerationEventResponse = client.sendTestGenerationEvent(
@@ -1413,6 +1391,23 @@ class CodeTestChatController(
14131391
}
14141392
}
14151393

1394+
private fun showFeedbackButton(): MutableList<Button> {
1395+
val buttonList = mutableListOf<Button>()
1396+
if (isInternalUser(getStartUrl(context.project))) {
1397+
buttonList.add(
1398+
Button(
1399+
"utg_feedback",
1400+
message("testgen.button.feedback"),
1401+
keepCardAfterClick = true,
1402+
position = "outside",
1403+
status = "info",
1404+
icon = "comment"
1405+
),
1406+
)
1407+
}
1408+
return buttonList
1409+
}
1410+
14161411
companion object {
14171412
private val LOG = getLogger<CodeTestChatController>()
14181413

0 commit comments

Comments
 (0)