Refactor authentication(issue controller).

This commit is contained in:
shimamoto
2013-07-03 18:00:52 +09:00
parent b59a4ce94b
commit eee723c266
2 changed files with 101 additions and 126 deletions

View File

@@ -20,9 +20,11 @@ trait IssuesService {
def getComments(owner: String, repository: String, issueId: Int) =
Query(IssueComments) filter (_.byIssue(owner, repository, issueId)) list
def getComment(commentId: String) =
def getComment(owner: String, repository: String, commentId: String) =
if (commentId forall (_.isDigit))
Query(IssueComments) filter (_.byPrimaryKey(commentId.toInt)) firstOption
Query(IssueComments) filter { t =>
t.byPrimaryKey(commentId.toInt) && t.byRepository(owner, repository)
} firstOption
else None
def getIssueLabels(owner: String, repository: String, issueId: Int) =