@@ -54,6 +54,7 @@ import software.aws.toolkits.jetbrains.core.AwsClientManager
5454import software.aws.toolkits.jetbrains.core.coroutines.EDT
5555import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager
5656import software.aws.toolkits.jetbrains.core.credentials.pinning.QConnection
57+ import software.aws.toolkits.jetbrains.core.credentials.sono.isInternalUser
5758import software.aws.toolkits.jetbrains.services.amazonq.apps.AmazonQAppInitContext
5859import software.aws.toolkits.jetbrains.services.amazonq.auth.AuthController
5960import 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