[kotlin] Add platform.feedback.ignore.common.conditions.for.all.surveys to test "extra" conditions for each survey

New registry key added


Merge-request: IJ-MR-124987
Merged-by: Victoria Petrakovich <Victoria.Petrakovich@jetbrains.com>

GitOrigin-RevId: 2da1b156802b11bd9fe2d38b15d16afad467517b
This commit is contained in:
Victoria.Petrakovich
2024-01-30 14:49:23 +00:00
committed by intellij-monorepo-bot
parent cbf5857fef
commit 9c29d9f442
2 changed files with 15 additions and 6 deletions

View File

@@ -23,6 +23,8 @@
<registryKey key="platform.feedback" defaultValue="true" description="Enable to collect user feedback"/>
<registryKey key="platform.feedback.time.to.show.notification" defaultValue="600"
description="Explicitly sets the number of seconds until the feedback notification is displayed."/>
<registryKey key="platform.feedback.ignore.common.conditions.for.all.surveys" defaultValue="false"
description="Allows to ignore all isSuitableToShow conditions and test pure conditions of the concrete survey"/>
<statistics.validation.customValidationRule
implementation="com.intellij.platform.feedback.impl.statistics.FeedbackSurveyIdValidationRule"/>

View File

@@ -5,6 +5,7 @@ import com.intellij.ide.BrowserUtil
import com.intellij.notification.NotificationAction
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.registry.Registry
import com.intellij.platform.feedback.*
import com.intellij.platform.feedback.impl.state.CommonFeedbackSurveyService
import com.intellij.platform.feedback.impl.state.DontShowAgainFeedbackService
@@ -55,12 +56,18 @@ internal fun showNotification(feedbackSurveyType: FeedbackSurveyType<*>, project
internal fun isSuitableToShow(feedbackSurveyConfig: FeedbackSurveyConfig, project: Project): Boolean {
return !CommonFeedbackSurveyService.checkIsFeedbackSurveyAnswerSent(feedbackSurveyConfig.surveyId) &&
feedbackSurveyConfig.checkIdeIsSuitable() &&
feedbackSurveyConfig.checkIsFeedbackCollectionDeadlineNotPast() &&
feedbackSurveyConfig.checkIsIdeEAPIfRequired() &&
checkNumberShowsNotExceeded(feedbackSurveyConfig) &&
feedbackSurveyConfig.checkExtraConditionSatisfied(project)
val commonConditionsForAllSurveys = if (Registry.`is`("platform.feedback.ignore.common.conditions.for.all.surveys", false)) {
true
}
else {
!CommonFeedbackSurveyService.checkIsFeedbackSurveyAnswerSent(feedbackSurveyConfig.surveyId) &&
feedbackSurveyConfig.checkIdeIsSuitable() &&
feedbackSurveyConfig.checkIsFeedbackCollectionDeadlineNotPast() &&
feedbackSurveyConfig.checkIsIdeEAPIfRequired() &&
checkNumberShowsNotExceeded(feedbackSurveyConfig)
}
val extraConditionsForSurvey = feedbackSurveyConfig.checkExtraConditionSatisfied(project)
return commonConditionsForAllSurveys && extraConditionsForSurvey
}
private fun invokeRespondNotificationAction(feedbackSurveyType: FeedbackSurveyType<*>, project: Project, forTest: Boolean) {