mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
(RIDER-116228) What's New: handle the scenario when a newer version was already shown
GitOrigin-RevId: 5879c0d9d756d061896fe9ea8a4a14e64f0c8df2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
108b155ea2
commit
c6cfc4db90
@@ -45,8 +45,8 @@ internal class WhatsNewContentVersionChecker {
|
||||
storedVersion: WhatsNewContent.ContentVersion,
|
||||
newVersion: WhatsNewContent.ContentVersion): Boolean {
|
||||
if (storedVersion.hash.nullize() != null && newVersion.hash.nullize() != null) {
|
||||
// If both versions have hashes, then show any new content.
|
||||
return storedVersion.hash != newVersion.hash
|
||||
// If both versions have hashes, then show any new content (i.e., hashes are different and the version is new).
|
||||
return storedVersion.hash != newVersion.hash && newVersion >= storedVersion
|
||||
}
|
||||
|
||||
// At least one of the versions doesn't have a hash: compare them by versions directly, preferring the newest.
|
||||
|
||||
@@ -33,7 +33,7 @@ class WhatsNewContentVersionCheckerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Comparison by two hashes just compares hashes and ignores versions`() {
|
||||
fun `Comparison by two hashes just compares hashes and ignores versions if the stored is older`() {
|
||||
var version1 = WhatsNewContent.ContentVersion("2020", "9.1", null, "123123")
|
||||
var version2 = WhatsNewContent.ContentVersion("2020", "10.1", null, "123123")
|
||||
assertFalse(WhatsNewContentVersionChecker.shouldShowWhatsNew(version1, version2))
|
||||
@@ -44,6 +44,19 @@ class WhatsNewContentVersionCheckerTest {
|
||||
|
||||
version1 = WhatsNewContent.ContentVersion("2020", "10.1", null, "1231234")
|
||||
version2 = WhatsNewContent.ContentVersion("2020", "9.1", null, "123123")
|
||||
assertTrue(WhatsNewContentVersionChecker.shouldShowWhatsNew(version1, version2))
|
||||
assertFalse(WhatsNewContentVersionChecker.shouldShowWhatsNew(version1, version2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Comparison with future version`() {
|
||||
var storedVersion = WhatsNewContent.ContentVersion("2020", "9.1", null, "123123")
|
||||
var newVersion = WhatsNewContent.ContentVersion("2020", "8.1", null, "321321")
|
||||
// On the one hand, the current content differs from the stored. On the other hand, the one stored is *newer*.
|
||||
assertFalse(WhatsNewContentVersionChecker.shouldShowWhatsNew(storedVersion, newVersion))
|
||||
|
||||
storedVersion = WhatsNewContent.ContentVersion("2020", "9.1", null, "123123")
|
||||
newVersion = WhatsNewContent.ContentVersion("2020", "9.1", null, "321321")
|
||||
// Hash-only change ⇒ show the page.
|
||||
assertTrue(WhatsNewContentVersionChecker.shouldShowWhatsNew(storedVersion, newVersion))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user