[Feedback] Move module content back to platform from IDEA
authorKonstantin Hudyakov <konstantin.hudyakov@jetbrains.com>
Tue, 24 May 2022 15:19:44 +0000 (18:19 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Thu, 26 May 2022 21:02:38 +0000 (21:02 +0000)
This fix will resolve IFT-378
Logic of this module (feedback dialogs) is required only in IDEA Community and Ultimate, so added the code to prohibit showing of project creation and Kotlin rejecters dialogs in other IDEs.

GitOrigin-RevId: 7b2e1ecf6ce0c7519bcaa2980be03d2b2145fbfc

community-resources/src/META-INF/IdeaPlugin.xml
platform/feedback/src/com/intellij/feedback/common/IdleFeedbackTypes.kt
platform/feedback/src/com/intellij/feedback/common/OpenApplicationFeedbackResolver.kt
platform/platform-resources/src/META-INF/PlatformLangPlugin.xml

index 8f20ba94fe98a73e6ec4fb27ebd8aac0a4afed41..07514f05626eb0cd8b580d05cd2ad845e11880ff 100644 (file)
@@ -24,7 +24,6 @@
 
   <content>
     <module name="intellij.notebooks.visualization"/>
-    <module name="intellij.platform.feedback"/>
     <module name="intellij.platform.images.copyright"/>
   </content>
 </idea-plugin>
index e3852a82509acf1684f8c842d1987fbbeb208aba..b8b720b7b5877b0ff43f7373a1eb041d1009093f 100644 (file)
@@ -10,6 +10,7 @@ import com.intellij.feedback.npw.state.ProjectCreationInfoService
 import com.intellij.feedback.npw.state.ProjectCreationInfoState
 import com.intellij.notification.Notification
 import com.intellij.notification.NotificationAction
+import com.intellij.openapi.application.ApplicationNamesInfo
 import com.intellij.openapi.application.ex.ApplicationInfoEx
 import com.intellij.openapi.project.Project
 import com.intellij.openapi.ui.DialogWrapper
@@ -19,18 +20,25 @@ enum class IdleFeedbackTypes {
     private val unknownProjectTypeName = "UNKNOWN"
     private val testProjectTypeName = "TEST"
     private val maxNumberNotificationShowed = 3
+    private val suitableIDEs = listOf("IntelliJ IDEA Community Edition", "IntelliJ IDEA Ultimate Edition")
     override val suitableIdeVersion: String = "2022.1"
 
     override fun isSuitable(): Boolean {
       val projectCreationInfoState = ProjectCreationInfoService.getInstance().state
 
       return isIntellijIdeaEAP() &&
+             checkIdeIsSuitable() &&
              checkIdeVersionIsSuitable() &&
              checkProjectCreationFeedbackNotSent(projectCreationInfoState) &&
              checkProjectCreated(projectCreationInfoState) &&
              checkNotificationNumberNotExceeded(projectCreationInfoState)
     }
 
+    private fun checkIdeIsSuitable(): Boolean {
+      val ideName = ApplicationNamesInfo.getInstance().fullProductNameWithEdition
+      return ideName in suitableIDEs
+    }
+
     private fun checkProjectCreationFeedbackNotSent(state: ProjectCreationInfoState): Boolean {
       return !state.feedbackSent
     }
index 322d7fd6dce00312bd466857caf80ea962005720..3555ecce3571392df780dff0f35c109ba5a8466f 100644 (file)
@@ -8,6 +8,7 @@ import com.intellij.feedback.kotlinRejecters.dialog.KotlinRejectersFeedbackDialo
 import com.intellij.ide.AppLifecycleListener
 import com.intellij.ide.feedback.kotlinRejecters.state.KotlinRejectersInfoService
 import com.intellij.notification.NotificationAction
+import com.intellij.openapi.application.ApplicationNamesInfo
 import com.intellij.openapi.project.Project
 import com.intellij.openapi.project.ex.ProjectManagerEx
 import kotlinx.datetime.Clock
@@ -20,6 +21,7 @@ class OpenApplicationFeedbackShower : AppLifecycleListener {
   companion object {
     val LAST_DATE_COLLECT_FEEDBACK = LocalDate(2022, 7, 19)
     const val MAX_NUMBER_NOTIFICATION_SHOWED = 3
+    private val suitableIDEs = listOf("IntelliJ IDEA Community Edition", "IntelliJ IDEA Ultimate Edition")
 
     fun showNotification(project: Project?, forTest: Boolean) {
       val notification = RequestFeedbackNotification(
@@ -44,6 +46,8 @@ class OpenApplicationFeedbackShower : AppLifecycleListener {
   }
 
   override fun appStarted() {
+    val ideName = ApplicationNamesInfo.getInstance().fullProductNameWithEdition
+    if (ideName !in suitableIDEs) return
     //Try to show only one possible feedback form - Kotlin Rejecters form
     val kotlinRejectersInfoState = KotlinRejectersInfoService.getInstance().state
     if (!kotlinRejectersInfoState.feedbackSent && kotlinRejectersInfoState.showNotificationAfterRestart &&
index d98cccdf3f5e7f82b3d94607605bb72d8b767de1..3d35c1069cf3ad747e8fd03a7a9f362a56c83095 100644 (file)
@@ -39,6 +39,8 @@
 
   <xi:include href="/META-INF/WorkspaceModelExtensions.xml"/>
 
+  <xi:include href="intellij.platform.feedback.xml"/>
+
   <extensions defaultExtensionNs="com.intellij">
     <applicationService serviceInterface="com.intellij.ide.RecentProjectsManager"
                         serviceImplementation="com.intellij.ide.AttachedModuleAwareRecentProjectsManager" preload="notHeadless"/>