Skip to content

Commit 1c8faa4

Browse files
authored
Making comments optional when submitting feedback (#3166)
* Making comments optioanl when submitting feedback * setting empty text to show the feedback comment is optional
1 parent a3e36f2 commit 1c8faa4

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

jetbrains-core/src/software/aws/toolkits/jetbrains/ui/feedback/FeedbackDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class FeedbackDialog(private val project: Project) : DialogWrapper(project) {
7575
val comment = panel.comment
7676

7777
return when {
78-
comment.isNullOrEmpty() -> ValidationInfo(message("feedback.validation.empty_comment"))
78+
comment.isNullOrEmpty() -> null
7979
comment.length >= SubmitFeedbackPanel.MAX_LENGTH -> ValidationInfo(message("feedback.validation.comment_too_long"))
8080
else -> null
8181
}

jetbrains-core/src/software/aws/toolkits/jetbrains/ui/feedback/SubmitFeedbackPanel.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class SubmitFeedbackPanel(initialSentiment: Sentiment? = null) {
5050

5151
private fun createUIComponents() {
5252
textArea = JBTextArea(6, 70)
53+
textArea.emptyText.text = message("feedback.comment.emptyText")
5354
textArea.lineWrap = true
5455
textAreaPane = JBScrollPane(textArea)
5556
smileIcon = JLabel(IconUtil.scale(AwsIcons.Misc.SMILE, null, 3f))
@@ -59,6 +60,14 @@ class SubmitFeedbackPanel(initialSentiment: Sentiment? = null) {
5960
textArea.document.addUndoableEditListener { onTextAreaUpdate() }
6061
}
6162

63+
@TestOnly
64+
internal fun setSentimentForTest(sentiment: Sentiment) {
65+
when (sentiment) {
66+
Sentiment.POSITIVE -> smileButton.isSelected = true
67+
else -> sadButton.isSelected = true
68+
}
69+
}
70+
6271
init {
6372
// runs after $$$setupUI$$$
6473
// null out placeholder text

jetbrains-core/tst/software/aws/toolkits/jetbrains/ui/feedback/FeedbackTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,9 @@ class FeedbackTest {
8383
runInEdtAndWait {
8484
val dialog = FeedbackDialog(projectRule.project)
8585
val panel = dialog.getViewForTesting()
86-
86+
panel.setSentimentForTest(Sentiment.POSITIVE)
8787
panel.comment = case
88-
assertThat(dialog.doValidate()).isInstanceOfSatisfying(ValidationInfo::class.java) {
89-
it.message.contains(message("feedback.validation.empty_comment"))
90-
}
88+
assertThat(dialog.doValidate()).isNull()
9189
}
9290
}
9391
}

resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ explorer.results_truncated=Results truncated, double click to load more
616616
explorer.stack.no.serverless.resources=Stack has no Lambda Functions
617617
explorer.view_documentation=View Documentation
618618
explorer.view_source=View Source on GitHub
619+
feedback.comment.emptyText=(optional)
619620
feedback.comment.label=Please enter your feedback
620621
feedback.description=Submit quick feedback about the AWS Toolkit for JetBrains
621622
feedback.github.link=<html>Have an issue or feature request?<br><a href="{0}">Talk to us on GitHub instead!</a></html>

0 commit comments

Comments
 (0)