fix missing version names in issue history - fixes #572

Mon, 13 Jan 2025 20:28:31 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 13 Jan 2025 20:28:31 +0100
changeset 341
354c4498437c
parent 340
7214dd755ded
child 342
50d94c216c3f

fix missing version names in issue history - fixes #572

src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog-de.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog.jspf file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Mon Jan 13 20:12:50 2025 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Mon Jan 13 20:28:31 2025 +0100
@@ -6,7 +6,6 @@
 import de.uapcore.lightpit.entities.Issue
 import de.uapcore.lightpit.entities.IssueComment
 import de.uapcore.lightpit.entities.IssueRelation
-import de.uapcore.lightpit.entities.Version
 import de.uapcore.lightpit.types.IssueCategory
 import de.uapcore.lightpit.types.IssueStatus
 import de.uapcore.lightpit.types.RelationType
@@ -50,8 +49,10 @@
     // TODO: process error messages
     eta = http.param("eta", ::dateOptValidator, null, mutableListOf())
 
-    affected = http.param("affected")?.toIntOrNull()?.takeIf { it > 0 }?.let { Version(it, project.id) }
-    resolved = http.param("resolved")?.toIntOrNull()?.takeIf { it > 0 }?.let { Version(it, project.id) }
+    // we must resolve the versions with the DAO, otherwise we do not get the names for the history
+    val vlookup = {paramKey: String -> http.param(paramKey)?.toIntOrNull()?.takeIf { it > 0 }?.let { dao.findVersion(it) }}
+    affected = vlookup("affected")
+    resolved = vlookup("resolved")
 }
 
 fun processIssueForm(issue: Issue, reference: Issue, http: HttpRequest, dao: DataAccessObject) {
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Mon Jan 13 20:12:50 2025 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Mon Jan 13 20:28:31 2025 +0100
@@ -27,6 +27,7 @@
 <h3>Version 1.5.0 (Vorschau)</h3>
 
 <ul>
+    <li>Versionsinformationen werden nun korrekt in die Vorgangshistorie geschrieben (relevant für RSS-Feeds).</li>
     <li>
         Fehler behoben, bei dem die Formulare für Versionen und Vorgänge existierende Datumsfelder mit dem
         falschen Jahr befüllen, wenn sich das Datum in Kalenderwoche 1, aber im Dezember befindet.
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Mon Jan 13 20:12:50 2025 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Mon Jan 13 20:28:31 2025 +0100
@@ -28,6 +28,10 @@
 
 <ul>
     <li>
+        Fix missing affected and target versions in issue history
+        (which is why they were never shown in the RSS feed).
+    </li>
+    <li>
         Fix that the versions form (release and EOL date) and the issue form (ETA) used
         the week-year instead of the year for loading an existing date into the form.
     </li>

mercurial