add "assign to me" button - resolves #798

Thu, 19 Feb 2026 17:13:07 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 19 Feb 2026 17:13:07 +0100
changeset 410
e70ac9e11fb1
parent 409
109850e92e95
child 411
568aff1e5d13

add "assign to me" button - resolves #798

src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/IssuesServlet.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt file | annotate | diff | comparison | revisions
src/main/resources/localization/strings.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/strings_de.properties 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/issue-view.jsp file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Thu Feb 19 17:13:07 2026 +0100
@@ -174,6 +174,18 @@
     dao.insertHistoryEvent(http.user, issue)
 }
 
+fun issueQuickAssign(http: HttpRequest, dao: DataAccessObject, issue: Issue) {
+    val newAssignee = http.user
+
+    // don't update when nothing changes
+    if (issue.assignee == newAssignee) return
+
+    // update the issue
+    issue.assignee = newAssignee
+    dao.updateIssue(issue)
+    dao.insertHistoryEvent(http.user, issue)
+}
+
 fun renderIssueView(
     http: HttpRequest,
     dao: DataAccessObject,
@@ -191,6 +203,7 @@
             dao.listIssueRelations(issue),
             dao.listCommitRefs(issue),
             pathInfos,
+            http.user,
             relationError,
         )
         if (pathInfos is PathInfosFull) {
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/IssuesServlet.kt	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/IssuesServlet.kt	Thu Feb 19 17:13:07 2026 +0100
@@ -21,6 +21,7 @@
         get("/%issue", this::issue)
         get("/%issue/edit", this::issueForm)
         get("/%issue/progress", this::issueProgress)
+        get("/%issue/assign", this::issueAssign)
         get("/%issue/resolve", this::issueResolve)
         post("/%issue/comment", this::issueComment)
         post("/%issue/relation", this::issueRelation)
@@ -67,6 +68,20 @@
         http.renderCommit("${pathInfos.issuesHref}${issue.id}")
     }
 
+    private fun issueAssign(http: HttpRequest, dao: DataAccessObject) {
+        if (http.user == null) {
+            http.response.sendError(403)
+            return
+        }
+        val issue = http.pathParams["issue"]?.toIntOrNull()?.let(dao::findIssue)
+        if (issue == null) {
+            http.response.sendError(404)
+            return
+        }
+        issueQuickAssign(http, dao, issue)
+        http.renderCommit("${pathInfos.issuesHref}${issue.id}")
+    }
+
     private fun issueResolve(http: HttpRequest, dao: DataAccessObject) {
         val issue = http.pathParams["issue"]?.toIntOrNull()?.let(dao::findIssue)
         if (issue == null) {
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Thu Feb 19 17:13:07 2026 +0100
@@ -67,6 +67,7 @@
         get("/%project/issues/%version/%component/%variant/%issue/edit", this::issueForm)
         get("/%project/issues/%version/%component/%variant/%issue/progress", this::issueProgress)
         get("/%project/issues/%version/%component/%variant/%issue/resolve", this::issueResolve)
+        get("/%project/issues/%version/%component/%variant/%issue/assign", this::issueAssign)
         post("/%project/issues/%version/%component/%variant/%issue/comment", this::issueComment)
         post("/%project/issues/%version/%component/%variant/%issue/relation", this::issueRelation)
         get("/%project/issues/%version/%component/%variant/%issue/removeRelation", this::issueRemoveRelation)
@@ -474,6 +475,23 @@
         }
     }
 
+    private fun issueAssign(http: HttpRequest, dao: DataAccessObject) {
+        if (http.user == null) {
+            http.response.sendError(403)
+            return
+        }
+        val issue = http.pathParams["issue"]?.toIntOrNull()?.let(dao::findIssue)
+        if (issue == null) {
+            http.response.sendError(404)
+            return
+        }
+        withPathInfo(http, dao)?.let { path ->
+            issueQuickAssign(http, dao, issue)
+            http.renderCommit("${path.issuesHref}${issue.id}")
+        }
+    }
+
+
     private fun issueForm(http: HttpRequest, dao: DataAccessObject) {
         withPathInfo(http, dao)?.let { path ->
             val issue = http.pathParams["issue"]?.toIntOrNull()?.let(dao::findIssue) ?: Issue(
--- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt	Thu Feb 19 17:13:07 2026 +0100
@@ -118,6 +118,7 @@
     val currentRelations: List<IssueRelation>,
     commitRefs: List<CommitRef>,
     val pathInfos: PathInfos,
+    val authenticatedUser: User? = null,
     /**
      * Optional resource key to an error message for the relation editor.
      */
@@ -126,6 +127,7 @@
     val relationTypes = RelationType.entries
     val commitLinks: List<CommitLink>
     val openedVariant: Variant? = ((pathInfos as? PathInfosFull)?.variantInfo as? OptionalPathInfo.Specific)?.elem
+    val isAssignedToAuthenticatedUser = authenticatedUser != null && authenticatedUser.id == issue.assignee?.id
 
     init {
         issue.description = formatMarkdown(issue.description)
--- a/src/main/resources/localization/strings.properties	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/resources/localization/strings.properties	Thu Feb 19 17:13:07 2026 +0100
@@ -35,6 +35,7 @@
 button.dismiss=Dismiss
 button.edit=Edit
 button.issue.all=All Issues
+button.issue.assign-myself=Assign To Me
 button.issue.create.another=Create another Issue
 button.issue.create=New Issue
 button.issue.edit=Edit
--- a/src/main/resources/localization/strings_de.properties	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/resources/localization/strings_de.properties	Thu Feb 19 17:13:07 2026 +0100
@@ -35,6 +35,7 @@
 button.dismiss=Nicht Jetzt
 button.edit=Bearbeiten
 button.issue.all=Alle Vorg\u00e4nge
+button.issue.assign-myself=Mir Zuweisen
 button.issue.create.another=Weiteren Vorgang erstellen
 button.issue.create=Neuer Vorgang
 button.issue.edit=Bearbeiten
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Thu Feb 19 17:13:07 2026 +0100
@@ -29,7 +29,7 @@
 <ul>
     <li>Neues Feature zur Planung von Versionen hinzugefügt.</li>
     <li>Pop-Up hinzugefügt, das über eine neue LightPIT-Version informiert.</li>
-    <li>Neue Schaltflächen zur Vorgangsansicht hinzugefügt, mit denen der Status des Vorgangs schnell geändert werden kann.</li>
+    <li>Neue Schaltflächen zur Vorgangsansicht hinzugefügt, mit denen der Status und die Zuweisung des Vorgangs schnell geändert werden können.</li>
     <li>"In Projekt Öffnen" Schaltfläche zur (globalen) Vorgangsansicht hinzugefügt.</li>
     <li>Schaltflächen hinzugefügt, die schnelleren Zugang zu den Editoren für Versionen, Komponenten und Varianten bieten.</li>
     <li>Es können nun neue Vorgänge direkt mit einer Verknüpfung zu einem existierenden Vorgang erstellt werden.</li>
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Thu Feb 19 17:13:07 2026 +0100
@@ -29,7 +29,7 @@
 <ul>
     <li>Add new version planning UI.</li>
     <li>Add popup informing about a new LightPIT release.</li>
-    <li>Add convenience buttons to the issue view to quickly change the issue status.</li>
+    <li>Add convenience buttons to the issue view to quickly change the issue status and assignee.</li>
     <li>Add convenience OPEN IN PROJECT button to the global issue view.</li>
     <li>Add buttons and hover-icons to quickly access the editor for versions, components, and variants.</li>
     <li>Add the possibility to create new related issues with one click.</li>
--- a/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Tue Jan 06 20:08:54 2026 +0100
+++ b/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Thu Feb 19 17:13:07 2026 +0100
@@ -200,6 +200,11 @@
         <fmt:message key="button.issue.open-in-project"/>
     </a>
     </c:if>
+    <c:if test="${not viewmodel.assignedToAuthenticatedUser}">
+        <a href="${issuesHref}${issue.id}/assign" class="button submit">
+            <fmt:message key="button.issue.assign-myself"/>
+        </a>
+    </c:if>
     <c:if test="${not issue.trackingVariantStatus or empty viewmodel.openedVariant}">
         <c:set scope="page" var="workflowPhase" value="${issue.minimumStatusPhaseAcrossAllVariants}"/>
     </c:if>
@@ -362,7 +367,7 @@
                 <c:if test="${not empty comment.author.mail}">
                     </a>
                 </c:if>
-                <c:if test="${comment.author.username eq pageContext.request.remoteUser}">
+                <c:if test="${comment.author eq viewmodel.authenticatedUser}">
                     <a class="comment-edit-icon" onclick="showCommentEditor(${comment.id})">&#x270e;</a>
                 </c:if>
             </c:if>

mercurial