diff --git a/src/main/scala/gitbucket/core/controller/IssuesController.scala b/src/main/scala/gitbucket/core/controller/IssuesController.scala index 3ee85c8..61ae064 100644 --- a/src/main/scala/gitbucket/core/controller/IssuesController.scala +++ b/src/main/scala/gitbucket/core/controller/IssuesController.scala @@ -258,7 +258,7 @@ loginAccount => getComment(repository.owner, repository.name, params("id")).map { comment => if (isEditableContent(repository.owner, repository.name, comment.commentedUserName, loginAccount)) { - updateComment(comment.issueId, comment.commentId, form.content) + updateComment(repository.owner, repository.name, comment.issueId, comment.commentId, form.content) redirect(s"/${repository.owner}/${repository.name}/issue_comments/_data/${comment.commentId}") } else Unauthorized() } getOrElse NotFound() diff --git a/src/main/scala/gitbucket/core/service/HandleCommentService.scala b/src/main/scala/gitbucket/core/service/HandleCommentService.scala index 0c6bd1e..f171824 100644 --- a/src/main/scala/gitbucket/core/service/HandleCommentService.scala +++ b/src/main/scala/gitbucket/core/service/HandleCommentService.scala @@ -165,7 +165,7 @@ content match { case Some(content) => // Update comment - val _commentId = Some(updateComment(issue.issueId, commentId.toInt, content)) + val _commentId = Some(updateComment(owner, name, issue.issueId, commentId.toInt, content)) // Record comment activity val commentInfo = if (issue.isPullRequest) { PullRequestCommentInfo(owner, name, userName, content, issue.issueId) diff --git a/src/main/scala/gitbucket/core/service/IssuesService.scala b/src/main/scala/gitbucket/core/service/IssuesService.scala index f701eb8..76eb8c0 100644 --- a/src/main/scala/gitbucket/core/service/IssuesService.scala +++ b/src/main/scala/gitbucket/core/service/IssuesService.scala @@ -509,7 +509,7 @@ content: String, action: String )(implicit s: Session): Int = { - Issues.filter(_.issueId === issueId.bind).map(_.updatedDate).update(currentDate) + Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(_.updatedDate).update(currentDate) IssueComments returning IssueComments.map(_.commentId) insert IssueComment( userName = owner, repositoryName = repository, @@ -635,8 +635,10 @@ .update(priorityId, currentDate) } - def updateComment(issueId: Int, commentId: Int, content: String)(implicit s: Session): Int = { - Issues.filter(_.issueId === issueId.bind).map(_.updatedDate).update(currentDate) + def updateComment(owner: String, repository: String, issueId: Int, commentId: Int, content: String)( + implicit s: Session + ): Int = { + Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(_.updatedDate).update(currentDate) IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.updatedDate)).update(content, currentDate) } @@ -644,7 +646,7 @@ implicit context: Context, s: Session ): Int = { - Issues.filter(_.issueId === issueId.bind).map(_.updatedDate).update(currentDate) + Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(_.updatedDate).update(currentDate) IssueComments.filter(_.byPrimaryKey(commentId)).firstOption match { case Some(c) if c.action == "reopen_comment" => IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.action)).update("Reopen", "reopen")