fix missing localization in RSS feed

Sun, 06 Oct 2024 15:08:50 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 06 Oct 2024 15:08:50 +0200
changeset 324
61b16fc21f4d
parent 323
ba2a1313eb98
child 325
388c1d2147d4

fix missing localization in RSS feed

fixes #422

build.gradle.kts file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/viewmodel/Feeds.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
src/main/webapp/WEB-INF/jsp/issues-feed.jsp file | annotate | diff | comparison | revisions
--- a/build.gradle.kts	Sat Aug 17 12:09:03 2024 +0200
+++ b/build.gradle.kts	Sun Oct 06 15:08:50 2024 +0200
@@ -5,7 +5,7 @@
     war
 }
 group = "de.uapcore"
-version = "1.3.0"
+version = "1.4.0-snapshot"
 
 repositories {
     mavenCentral()
@@ -41,7 +41,7 @@
                 arrayOf(
                     "jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:3.0.0",
                     "org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.1",
-                    "org.postgresql:postgresql:42.7.3"
+                    "org.postgresql:postgresql:42.7.4"
                 ).forEach {
                     if (libsAreProvided) compileOnly(it) else implementation(it)
                 }
@@ -57,7 +57,7 @@
         val test by getting {
             dependencies {
                 implementation("org.jetbrains.kotlin:kotlin-test-junit5")
-                runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.3")
+                runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.2")
             }
         }
     }
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt	Sat Aug 17 12:09:03 2024 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt	Sun Oct 06 15:08:50 2024 +0200
@@ -77,14 +77,12 @@
             ).joinToString("\n", transform = DiffRow::getOldLine)
         )
 
-    private fun fullContent(issue: IssueHistoryEntry) = IssueDiff(
+    private fun fullContent(http: HttpRequest, issue: IssueHistoryEntry) = IssueDiff(
         issue.issueid,
-        issue.subject,
         issue.project,
         issue.component,
-        issue.status.name,
-        issue.category.name,
-        issue.category.name,
+        http.i18n("issue.status."+issue.status.name),
+        http.i18n("issue.category."+issue.category.name),
         issue.subject,
         issue.description.replace("\r", ""),
         issue.assignee,
@@ -93,9 +91,9 @@
         issue.resolved
     )
 
-    private fun diffContent(cur: IssueHistoryEntry, next: IssueHistoryEntry): IssueDiff {
-        val prev = fullContent(next)
-        val diff = fullContent(cur)
+    private fun diffContent(http: HttpRequest, cur: IssueHistoryEntry, next: IssueHistoryEntry): IssueDiff {
+        val prev = fullContent(http, next)
+        val diff = fullContent(http, cur)
         val result = diffGenerator.generateDiffRows(
             listOf(
                 prev.subject, prev.component, prev.status,
@@ -129,22 +127,23 @@
      * Assumes that [issueEntries] and [commentEntries] are already sorted by timestamp (descending).
      */
     private fun generateFeedEntries(
+        http: HttpRequest,
         issueEntries: List<IssueHistoryEntry>,
         commentEntries: List<IssueCommentHistoryEntry>
     ): List<IssueFeedEntry> =
-        (generateIssueFeedEntries(issueEntries) + generateCommentFeedEntries(commentEntries)).sortedByDescending { it.time }
+        (generateIssueFeedEntries(http, issueEntries) + generateCommentFeedEntries(commentEntries)).sortedByDescending { it.time }
 
-    private fun generateIssueFeedEntries(entries: List<IssueHistoryEntry>): List<IssueFeedEntry> =
+    private fun generateIssueFeedEntries(http: HttpRequest, entries: List<IssueHistoryEntry>): List<IssueFeedEntry> =
         if (entries.isEmpty()) {
             emptyList()
         } else {
             entries.groupBy { it.issueid }.mapValues { (_, history) ->
                 history.zipWithNext().map { (cur, next) ->
                     IssueFeedEntry(
-                        cur.time, cur.type, issue = diffContent(cur, next)
+                        cur.time, cur.type, issue = diffContent(http, cur, next)
                     )
                 }.plus(
-                    history.last().let { IssueFeedEntry(it.time, it.type, issue = fullContent(it)) }
+                    history.last().let { IssueFeedEntry(it.time, it.type, issue = fullContent(http, it)) }
                 )
             }.flatMap { it.value }
         }
@@ -192,7 +191,7 @@
             else -> emptyList()
         }
 
-        http.view = IssueFeed(project, generateFeedEntries(issueHistory, commentHistory))
+        http.view = IssueFeed(project, generateFeedEntries(http, issueHistory, commentHistory))
         http.renderFeed("issues-feed")
     }
 }
\ No newline at end of file
--- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Feeds.kt	Sat Aug 17 12:09:03 2024 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Feeds.kt	Sun Oct 06 15:08:50 2024 +0200
@@ -32,19 +32,20 @@
 
 class IssueDiff(
     val id: Int,
-    val currentSubject: String,
     val project: String,
     var component: String,
     var status: String,
     var category: String,
-    var currentCategory: String,
     var subject: String,
     var description: String,
     var assignee: String,
     var eta: String,
     var affected: String,
     var resolved: String,
-)
+) {
+    var currentCategory: String = category
+    val currentSubject: String = subject
+}
 
 class CommentDiff(
     val issueid: Int,
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sat Aug 17 12:09:03 2024 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sun Oct 06 15:08:50 2024 +0200
@@ -24,6 +24,12 @@
   --%>
 <%@ page contentType="text/html;charset=UTF-8" %>
 
+<h3>Version 1.4.0 (Vorschau)</h3>
+
+<ul>
+    <li>Status und Kategorie eines Vorgangs sind nun auch im RSS-Feed korrekt lokalisiert.</li>
+</ul>
+
 <h3>Version 1.3.0</h3>
 
 <ul>
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sat Aug 17 12:09:03 2024 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sun Oct 06 15:08:50 2024 +0200
@@ -24,6 +24,12 @@
   --%>
 <%@ page contentType="text/html;charset=UTF-8" %>
 
+<h3>Version 1.4.0 (snapshot)</h3>
+
+<ul>
+    <li>Fix missing localization for issue status and category in RSS feed.</li>
+</ul>
+
 <h3>Version 1.3.0</h3>
 
 <ul>
--- a/src/main/webapp/WEB-INF/jsp/issues-feed.jsp	Sat Aug 17 12:09:03 2024 +0200
+++ b/src/main/webapp/WEB-INF/jsp/issues-feed.jsp	Sun Oct 06 15:08:50 2024 +0200
@@ -65,7 +65,7 @@
                         <h2><fmt:message key="issue.description"/></h2>
                         <div style="white-space: pre-wrap;">${issue.description}</div>
                     ]]></description>
-                    <category><fmt:message key="issue.category.${issue.currentCategory}"/></category>
+                    <category>${issue.currentCategory}</category>
                 </c:when>
                 <c:when test="${not empty entry.comment}">
                     <c:set var="comment" value="${entry.comment}"/>

mercurial