From f17f8b948b9c5d7b49494e19bf6644521517a249 Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Tue, 15 Oct 2024 16:49:28 +0200 Subject: [PATCH] [feedback] IJPL-162562 Fix license metadata usage for feedback form URLs GitOrigin-RevId: c4e2653728ae1386dd2e2d86540acdd5fca8958b --- .../JetBrainsFeedbackReporter.kt | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/platform/ide/impl/customization/JetBrainsFeedbackReporter.kt b/platform/platform-impl/src/com/intellij/platform/ide/impl/customization/JetBrainsFeedbackReporter.kt index d0419371e445..30b8b6905a46 100644 --- a/platform/platform-impl/src/com/intellij/platform/ide/impl/customization/JetBrainsFeedbackReporter.kt +++ b/platform/platform-impl/src/com/intellij/platform/ide/impl/customization/JetBrainsFeedbackReporter.kt @@ -21,16 +21,35 @@ class JetBrainsFeedbackReporter(private val productName: String, val appInfo = ApplicationInfo.getInstance() val build = appInfo.getBuild() + val metadata = LicensingFacade.getInstance()?.metadata?.takeIf { it.length > 10 } + val isEval = LicensingFacade.getInstance()?.isEvaluationLicense == true + return Urls.newFromEncoded("https://www.jetbrains.com/feedback/feedback.jsp") .addParameters(mapOf( "product" to productName, "build" to if (appInfo.isEAP) build.asStringWithoutProductCode() else build.asString(), "timezone" to System.getProperty("user.timezone", ""), - "eval" to (LicensingFacade.getInstance()?.isEvaluationLicense == true).toString(), - "license" to (LicensingFacade.getInstance()?.subType ?: "unknown") + "eval" to isEval.toString(), + "license" to licenseInfo(metadata, isEval) )) } + // how license flags are passed to web URLs + private fun licenseInfo(metadata: String?, isEval: Boolean): String { + if (isEval) return "eval" + + val char = metadata?.get(10) + when (char) { + 'C' -> return "commercial" + 'E' -> return "academic" + 'F' -> return "free" + 'L' -> return "classroom" + 'O' -> return "opensource" + 'P' -> return "personal" + else -> return "unknown" + } + } + override fun showFeedbackForm(project: Project?, requestedForEvaluation: Boolean): Boolean { if (requestedForEvaluation && useInIdeEvaluationFeedback) { val feedbackDialogs = PlatformFeedbackDialogs.getInstance()