From 0c2bdc68f1b1b32f1e27d17a6d4a40604a66503e Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 22 Mar 2019 17:59:00 +0300 Subject: [PATCH] Additional checks for `listed` and `approve` in fetching release date (KT-30388) --- .../org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt index 634f2f91ff3..c4af83edb02 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt @@ -336,6 +336,11 @@ class KotlinPluginUpdater(private val propertiesComponent: PropertiesComponent) private class PluginDTO { var cdate: String? = null var channel: String? = null + // `true` if the version is seen in plugin site and available for download. + // Maybe be `false` if author requested version deletion. + var listed: Boolean = true + // `true` if version is approved and verified + var approve: Boolean = true } @Throws(IOException::class, ResponseParseException::class) @@ -352,7 +357,10 @@ class KotlinPluginUpdater(private val propertiesComponent: PropertiesComponent) throw ResponseParseException("Can't parse json response", syntaxException) } - val selectedPluginDTO = pluginDTOs.singleOrNull { it.channel == channel || (it.channel == "" && channel == null) } + val selectedPluginDTO = pluginDTOs + .firstOrNull { + it.listed && it.approve && (it.channel == channel || (it.channel == "" && channel == null)) + } ?: return null val dateString = selectedPluginDTO.cdate ?: throw ResponseParseException("Empty cdate")