make initialization of diff records explicit + revert change regarding property access

Sun, 14 Sep 2025 14:06:16 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 14 Sep 2025 14:06:16 +0200
changeset 385
7e3afd24ae76
parent 384
4e43b87be5f2
child 386
41ce87983ab5

make initialization of diff records explicit + revert change regarding property access

src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt	Sun Sep 14 14:05:53 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt	Sun Sep 14 14:06:16 2025 +0200
@@ -60,68 +60,69 @@
 
     private fun fullContent(data: IssueCommentHistoryEntry) =
         CommentDiff(
-            data.issueid,
-            data.commentid,
-            data.project,
-            data.subject,
-            data.comment.replace("\r", "")
+            issueid = data.issueid,
+            id = data.commentid,
+            project = data.project,
+            currentSubject = data.subject,
+            comment = data.comment.replace("\r", "")
         )
 
     private fun diffContent(cur: IssueCommentHistoryEntry, next: IssueCommentHistoryEntry) =
         CommentDiff(
-            cur.issueid,
-            cur.commentid,
-            cur.project,
-            cur.subject,
-            diffGenerator.generateDiffRows(
+            issueid = cur.issueid,
+            id = cur.commentid,
+            project = cur.project,
+            currentSubject = cur.subject,
+            comment = diffGenerator.generateDiffRows(
                 next.comment.replace("\r", "").split('\n'),
                 cur.comment.replace("\r", "").split('\n')
-            ).joinToString("\n", transform = DiffRow::oldLine)
+            ).joinToString("\n", transform = DiffRow::getOldLine)
         )
 
     private fun fullContent(http: HttpRequest, issue: IssueHistoryEntry) = IssueDiff(
-        issue.issueid,
-        issue.project,
-        issue.component,
-        http.i18n("issue.status."+issue.status.name),
-        http.i18n("issue.category."+issue.category.name),
-        issue.subject,
-        issue.description.replace("\r", ""),
-        issue.assignee,
-        issue.eta?.let { SimpleDateFormat("dd.MM.yyyy").format(it) } ?: "",
-        issue.affected,
-        issue.resolved
+        id = issue.issueid,
+        project = issue.project,
+        component = issue.component,
+        status = http.i18n("issue.status."+issue.status.name),
+        category = http.i18n("issue.category."+issue.category.name),
+        subject = issue.subject,
+        description = issue.description.replace("\r", ""),
+        assignee = issue.assignee,
+        eta = issue.eta?.let { SimpleDateFormat("dd.MM.yyyy").format(it) } ?: "",
+        affected = issue.affected,
+        resolved = issue.resolved
     )
 
     private fun diffContent(http: HttpRequest, cur: IssueHistoryEntry, next: IssueHistoryEntry): IssueDiff {
-        val prev = fullContent(http, next)
-        val diff = fullContent(http, cur)
+        val nextContent = fullContent(http, next)
+        val curContent = fullContent(http, cur)
         val result = diffGenerator.generateDiffRows(
             listOf(
-                prev.subject, prev.component, prev.status,
-                prev.category, prev.assignee, prev.eta, prev.affected, prev.resolved
+                nextContent.subject, nextContent.component, nextContent.status,
+                nextContent.category, nextContent.assignee, nextContent.eta, nextContent.affected, nextContent.resolved
             ),
             listOf(
-                diff.subject, diff.component, diff.status,
-                diff.category, diff.assignee, diff.eta, diff.affected, diff.resolved
+                curContent.subject, curContent.component, curContent.status,
+                curContent.category, curContent.assignee, curContent.eta, curContent.affected, curContent.resolved
             )
         )
 
-        diff.subject = result[0].oldLine
-        diff.component = result[1].oldLine
-        diff.status = result[2].oldLine
-        diff.category = result[3].oldLine
-        diff.assignee = result[4].oldLine
-        diff.eta = result[5].oldLine
-        diff.affected = result[6].oldLine
-        diff.resolved = result[7].oldLine
-
-        diff.description = diffGenerator.generateDiffRows(
-            prev.description.split('\n'),
-            diff.description.split('\n')
-        ).joinToString("\n", transform = DiffRow::oldLine)
-
-        return diff
+        return IssueDiff(
+            id = curContent.id,
+            project = curContent.project,
+            subject = result[0].oldLine,
+            component = result[1].oldLine,
+            status = result[2].oldLine,
+            category = result[3].oldLine,
+            assignee = result[4].oldLine,
+            eta = result[5].oldLine,
+            affected = result[6].oldLine,
+            resolved = result[7].oldLine,
+            description = diffGenerator.generateDiffRows(
+                nextContent.description.split('\n'),
+                curContent.description.split('\n')
+            ).joinToString("\n", transform = DiffRow::getOldLine)
+        )
     }
 
     /**

mercurial