(refs #103) Add issue comment deletion.

This commit is contained in:
shimamoto
2013-10-21 05:11:53 +09:00
parent 7c7da7379d
commit 7afe7fbb5f
3 changed files with 28 additions and 1 deletions

View File

@@ -155,6 +155,16 @@ trait IssuesControllerBase extends ControllerBase {
}
})
ajaxPost("/:owner/:repository/issue_comments/delete/:id")(readableUsersOnly { repository =>
defining(repository.owner, repository.name){ case (owner, name) =>
getComment(owner, name, params("id")).map { comment =>
if(isEditable(owner, name, comment.commentedUserName)){
Ok(deleteComment(comment.commentId))
} else Unauthorized
} getOrElse NotFound
}
})
ajaxGet("/:owner/:repository/issues/_data/:id")(readableUsersOnly { repository =>
getIssue(repository.owner, repository.name, params("id")) map { x =>
if(isEditable(x.userName, x.repositoryName, x.openedUserName)){

View File

@@ -249,6 +249,9 @@ trait IssuesService {
}
.update (content, currentDate)
def deleteComment(commentId: Int) =
IssueComments filter (_.byPrimaryKey(commentId)) delete
def updateClosed(owner: String, repository: String, issueId: Int, closed: Boolean) =
Issues
.filter (_.byPrimaryKey(owner, repository, issueId))