diff -r fe4de34822a5 -r 479dd7993ef9 src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt --- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Mon Aug 02 15:13:04 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Mon Aug 02 17:04:17 2021 +0200 @@ -441,7 +441,6 @@ with(http) { pageTitle = "${projectInfo.project.name}: #${issue.id} ${issue.subject}" view = IssueDetailView(issue, comments, project, version, component) - // TODO: feed path for this particular issue feedPath = feedPath(projectInfo.project) navigationMenu = activeProjectNavMenu( dao.listProjects(), @@ -450,6 +449,7 @@ component ) styleSheets = listOf("projects") + javascript = "issue-editor" render("issue-view") } } @@ -492,6 +492,7 @@ component ) styleSheets = listOf("projects") + javascript = "issue-editor" render("issue-form") } } @@ -506,13 +507,26 @@ } // TODO: throw validator exception instead of using a default - val comment = IssueComment(-1, issue.id).apply { - author = http.remoteUser?.let { dao.findUserByName(it) } - comment = http.param("comment") ?: "" + + val commentId = http.param("commentid")?.toIntOrNull() ?: -1 + if (commentId > 0) { + val comment = dao.findComment(commentId) + val originalAuthor = comment?.author?.username + if (originalAuthor != null && originalAuthor == http.remoteUser) { + comment.comment = http.param("comment") ?: "" + dao.updateComment(comment) + } else { + http.response.sendError(403) + return + } + } else { + val comment = IssueComment(-1, issue.id).apply { + author = http.remoteUser?.let { dao.findUserByName(it) } + comment = http.param("comment") ?: "" + } + dao.insertComment(comment) } - dao.insertComment(comment) - http.renderCommit("${issuesHref}${issue.id}") } }