fix #1763 when deleting comment, close_comment => close / reopen_comment => reopen. not delete.

This commit is contained in:
KOUNOIKE Yuusuke
2017-10-31 22:39:19 +09:00
parent fa2d7db0ca
commit bd63e1e75e

View File

@@ -369,7 +369,14 @@ trait IssuesService {
def deleteComment(issueId: Int, commentId: Int)(implicit s: Session): Int = {
Issues.filter(_.issueId === issueId.bind).map(_.updatedDate).update(currentDate)
IssueComments.filter(_.byPrimaryKey(commentId)).delete
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")
case Some(c) if c.action == "close_comment" =>
IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.action)).update("Close", "close")
case Some(_) =>
IssueComments.filter(_.byPrimaryKey(commentId)).delete
}
}
def updateClosed(owner: String, repository: String, issueId: Int, closed: Boolean)(implicit s: Session): Int = {