issue can no longer be linked to themselves - fixes #713 default tip

Thu, 04 Sep 2025 20:35:29 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 04 Sep 2025 20:35:29 +0200
changeset 378
ee605da75f78
parent 377
f6e409c17fab

issue can no longer be linked to themselves - fixes #713

src/main/kotlin/de/uapcore/lightpit/Constants.kt file | annotate | diff | comparison | revisions
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
src/main/webapp/WEB-INF/jsp/issue-form.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/issue-view.jsp file | annotate | diff | comparison | revisions
src/main/webapp/issue-search.js file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/Constants.kt	Thu Sep 04 20:20:36 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/Constants.kt	Thu Sep 04 20:35:29 2025 +0200
@@ -29,7 +29,7 @@
     /**
      * A data in yyyy-mm-dd format to identify the release.
      */
-    const val VERSION_DATE = "2025-05-26"
+    const val VERSION_DATE = "2025-09-04"
 
     /**
      * The path where the JSP files reside.
--- a/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Thu Sep 04 20:20:36 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Thu Sep 04 20:35:29 2025 +0200
@@ -210,6 +210,7 @@
     val targetIssue: Issue? = http.param("issue")?.let {
         (if (it.startsWith("#") && it.length > 1) (it.substring(1).split(" ", limit = 2)[0]) else it)
             .toIntOrNull()
+            ?.takeIf { id -> id != issue.id }
             ?.let(dao::findIssue)
             ?.takeIf { target -> target.project.id == issue.project.id }
     }
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Thu Sep 04 20:20:36 2025 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Thu Sep 04 20:35:29 2025 +0200
@@ -32,6 +32,7 @@
     <li>"In Projekt Öffnen" Schaltfläche zur (globalen) Vorgangsansicht hinzugefügt.</li>
     <li>Vorgänge können nun auch direkt über die Vorgangsnummer (anstatt Raute + Nummer) verlinkt werden.</li>
     <li>Die Standardkategorie für neue Vorgänge in veröffentlichten Versionen ist nun "Fehler" anstelle von "Feature".</li>
+    <li>Vorgänge können nicht länger mit sich selbst verlinkt werden.</li>
     <li>Fehler in der Deutschen Übersetzung behoben.</li>
 </ul>
 
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Thu Sep 04 20:20:36 2025 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Thu Sep 04 20:35:29 2025 +0200
@@ -32,6 +32,7 @@
     <li>Add convenience OPEN IN PROJECT button to the global issue view.</li>
     <li>Change that you can now relate issues by just submitting their number (instead of hash + number).</li>
     <li>Change that the default category for new issues in released versions is Bug instead of Feature.</li>
+    <li>Fix that issues could relate to themselves.</li>
     <li>Fix errors in the German translation.</li>
 </ul>
 
--- a/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Thu Sep 04 20:20:36 2025 +0200
+++ b/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Thu Sep 04 20:35:29 2025 +0200
@@ -45,7 +45,10 @@
         <c:if test="${viewmodel.issue.id ge 0}">
         <tr>
             <th><fmt:message key="issue.id"/></th>
-            <td>${issue.id}</td>
+            <td>
+                ${issue.id}
+                <input type="hidden" id="opened-issue-id" value="${issue.id}"/>
+            </td>
         </tr>
         </c:if>
         <tr>
--- a/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Thu Sep 04 20:20:36 2025 +0200
+++ b/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Thu Sep 04 20:35:29 2025 +0200
@@ -47,7 +47,10 @@
     <tbody>
     <tr>
         <th><fmt:message key="issue.id"/></th>
-        <td>${issue.id}</td>
+        <td>
+            ${issue.id}
+            <input type="hidden" id="opened-issue-id" value="${issue.id}"/>
+        </td>
         <th><fmt:message key="issue.category"/></th>
         <td>
             <div class="issue-tag ${issue.category}">
--- a/src/main/webapp/issue-search.js	Thu Sep 04 20:20:36 2025 +0200
+++ b/src/main/webapp/issue-search.js	Thu Sep 04 20:35:29 2025 +0200
@@ -38,9 +38,12 @@
         searchBoxOldContent = searchBox.value;
         const req = new XMLHttpRequest();
         req.addEventListener("load", (evt) => {
+            const openedIssueIdElem = document.getElementById('opened-issue-id');
+            const openedIssueId = openedIssueIdElem ? ('#' + openedIssueIdElem.value) : '';
             const dataList = document.getElementById(elementId+'-list');
             dataList.innerHTML = '';
             JSON.parse(evt.target.responseText).forEach(function(item){
+                if (openedIssueId.length > 0 && item.startsWith(openedIssueId)) return;
                 const option = document.createElement('option');
                 option.value = item;
                 dataList.appendChild(option);

mercurial