fix currentAssignee filter not used for comments

Tue, 14 Jan 2025 19:21:48 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 14 Jan 2025 19:21:48 +0100
changeset 344
7280393d1fa7
parent 343
5fa3e40d0de0
child 345
7a515768c481

fix currentAssignee filter not used for comments

src/main/kotlin/de/uapcore/lightpit/entities/IssueHistoryEntry.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/entities/IssueHistoryEntry.kt	Mon Jan 13 21:38:06 2025 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/entities/IssueHistoryEntry.kt	Tue Jan 14 19:21:48 2025 +0100
@@ -36,6 +36,9 @@
     val subject: String,
     val time: Timestamp,
     val type: IssueHistoryType,
+    /**
+     * Used for filtering issue entries based on current assignment.
+     */
     val currentAssignee: String?,
     val issueid: Int,
     val component: String,
@@ -52,6 +55,9 @@
     val subject: String,
     val time: Timestamp,
     val type: IssueHistoryType,
+    /**
+     * Unused at the moment, but might be used in the future to filter comments.
+     */
     val currentAssignee: String?,
     val issueid: Int,
     val commentid: Int,
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt	Mon Jan 13 21:38:06 2025 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt	Tue Jan 14 19:21:48 2025 +0100
@@ -185,11 +185,14 @@
             issuesFromDb.filter { assignees.contains(it.currentAssignee) }
 
         val commentsFromDb = dao.listIssueCommentHistory(project, days)
-        val commentHistory = when (comments) {
+        var commentHistory = when (comments) {
             "all" -> commentsFromDb
             "new" -> commentsFromDb.filter { it.type == IssueHistoryType.NewComment }
             else -> emptyList()
         }
+        if (assignees != null) {
+            commentHistory = commentHistory.filter { assignees.contains(it.currentAssignee) }
+        }
 
         http.view = IssueFeed(project, generateFeedEntries(http, issueHistory, commentHistory))
         http.renderFeed("issues-feed")

mercurial