diff --git a/src/main/scala/gitbucket/core/controller/IssuesController.scala b/src/main/scala/gitbucket/core/controller/IssuesController.scala index 9bebbfc..e24cc55 100644 --- a/src/main/scala/gitbucket/core/controller/IssuesController.scala +++ b/src/main/scala/gitbucket/core/controller/IssuesController.scala @@ -193,7 +193,7 @@ defining(repository.owner, repository.name){ case (owner, name) => getComment(owner, name, params("id")).map { comment => if(isEditableContent(owner, name, comment.commentedUserName)){ - updateComment(comment.commentId, form.content) + updateComment(comment.issueId, comment.commentId, form.content) redirect(s"/${owner}/${name}/issue_comments/_data/${comment.commentId}") } else Unauthorized() } getOrElse NotFound() @@ -204,7 +204,7 @@ defining(repository.owner, repository.name){ case (owner, name) => getComment(owner, name, params("id")).map { comment => if(isEditableContent(owner, name, comment.commentedUserName)){ - Ok(deleteComment(comment.commentId)) + Ok(deleteComment(comment.issueId, 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 f7ce6ff..3ef52e6 100644 --- a/src/main/scala/gitbucket/core/service/HandleCommentService.scala +++ b/src/main/scala/gitbucket/core/service/HandleCommentService.scala @@ -50,7 +50,7 @@ id } - actionActivity foreach ( _ (owner, name, userName, issue.issueId, issue.title) ) + actionActivity.foreach { f => f(owner, name, userName, issue.issueId, issue.title) } // call web hooks action match { diff --git a/src/main/scala/gitbucket/core/service/IssuesService.scala b/src/main/scala/gitbucket/core/service/IssuesService.scala index a782dde..802b397 100644 --- a/src/main/scala/gitbucket/core/service/IssuesService.scala +++ b/src/main/scala/gitbucket/core/service/IssuesService.scala @@ -327,6 +327,7 @@ def createComment(owner: String, repository: String, loginUser: String, issueId: Int, content: String, action: String)(implicit s: Session): Int = { + Issues.filter(_.issueId === issueId.bind).map(_.updatedDate).update(currentDate) IssueComments returning IssueComments.map(_.commentId) insert IssueComment( userName = owner, repositoryName = repository, @@ -342,31 +343,33 @@ Issues .filter (_.byPrimaryKey(owner, repository, issueId)) .map { t => (t.title, t.content.?, t.updatedDate) } - .update (title, content, currentDate) + .update(title, content, currentDate) } def updateAssignedUserName(owner: String, repository: String, issueId: Int, assignedUserName: Option[String])(implicit s: Session): Int = { - Issues.filter (_.byPrimaryKey(owner, repository, issueId)).map(_.assignedUserName?).update (assignedUserName) + Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(t => (t.assignedUserName?, t.updatedDate)).update(assignedUserName, currentDate) } def updateMilestoneId(owner: String, repository: String, issueId: Int, milestoneId: Option[Int])(implicit s: Session): Int = { - Issues.filter (_.byPrimaryKey(owner, repository, issueId)).map(_.milestoneId?).update (milestoneId) + Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(t => (t.milestoneId?, t.updatedDate)).update(milestoneId, currentDate) } def updatePriorityId(owner: String, repository: String, issueId: Int, priorityId: Option[Int])(implicit s: Session): Int = { - Issues.filter (_.byPrimaryKey(owner, repository, issueId)).map(_.priorityId?).update (priorityId) + Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(t => (t.priorityId?, t.updatedDate)).update(priorityId, currentDate) } - def updateComment(commentId: Int, content: String)(implicit s: Session): Int = { - IssueComments.filter (_.byPrimaryKey(commentId)).map(t => (t.content, t.updatedDate)).update(content, currentDate) + def updateComment(issueId: Int, commentId: Int, content: String)(implicit s: Session): Int = { + Issues.filter(_.issueId === issueId.bind).map(_.updatedDate).update(currentDate) + IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.updatedDate)).update(content, currentDate) } - def deleteComment(commentId: Int)(implicit s: Session): Int = { - IssueComments filter (_.byPrimaryKey(commentId)) delete + def deleteComment(issueId: Int, commentId: Int)(implicit s: Session): Int = { + Issues.filter(_.issueId === issueId.bind).map(_.updatedDate).update(currentDate) + IssueComments.filter(_.byPrimaryKey(commentId)).delete } def updateClosed(owner: String, repository: String, issueId: Int, closed: Boolean)(implicit s: Session): Int = { - (Issues filter (_.byPrimaryKey(owner, repository, issueId)) map(t => (t.closed, t.updatedDate))).update((closed, currentDate)) + Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(t => (t.closed, t.updatedDate)).update(closed, currentDate) } /**