(refs #920) Remove IssueOrPullRequest. it is too much for this purpose

This commit is contained in:
nazoking
2015-10-02 11:59:25 +09:00
parent bf64f6b4f4
commit ace65cf261
4 changed files with 10 additions and 15 deletions

View File

@@ -14,8 +14,8 @@ case class ApiComment(
user: ApiUser,
body: String,
created_at: Date,
updated_at: Date)(repositoryName: RepositoryName, issueId: Int, issueOrPullRequest: IssueOrPullRequest){
val html_url = ApiPath(s"/${repositoryName.fullName}/${issueOrPullRequest.path}/${issueId}#comment-${id}")
updated_at: Date)(repositoryName: RepositoryName, issueId: Int, isPullRequest: Boolean){
val html_url = ApiPath(s"/${repositoryName.fullName}/${if(isPullRequest){ "pull" }else{ "issues" }}/${issueId}#comment-${id}")
}
object ApiComment{
@@ -25,5 +25,5 @@ object ApiComment{
user = user,
body = comment.content,
created_at = comment.registeredDate,
updated_at = comment.updatedDate)(repositoryName, issueId, IssueOrPullRequest(isPullRequest))
updated_at = comment.updatedDate)(repositoryName, issueId, isPullRequest)
}

View File

@@ -17,9 +17,9 @@ case class ApiIssue(
state: String,
created_at: Date,
updated_at: Date,
body: String)(repositoryName: RepositoryName, issueOrPullRequest: IssueOrPullRequest){
body: String)(repositoryName: RepositoryName, isPullRequest: Boolean){
val comments_url = ApiPath(s"/api/v3/repos/${repositoryName.fullName}/issues/${number}/comments")
val html_url = ApiPath(s"/${repositoryName.fullName}/${issueOrPullRequest.path}/${number}")
val html_url = ApiPath(s"/${repositoryName.fullName}/${if(isPullRequest){ "pull" }else{ "issues" }}/${number}")
}
object ApiIssue{
@@ -31,5 +31,5 @@ object ApiIssue{
state = if(issue.closed){ "closed" }else{ "open" },
body = issue.content.getOrElse(""),
created_at = issue.registeredDate,
updated_at = issue.updatedDate)(repositoryName, IssueOrPullRequest(issue.isPullRequest))
updated_at = issue.updatedDate)(repositoryName, issue.isPullRequest)
}

View File

@@ -1,5 +0,0 @@
package gitbucket.core.api
case class IssueOrPullRequest(isPullRequest:Boolean){
val path = if(isPullRequest){ "pull" }else{ "issues" }
}

View File

@@ -90,7 +90,7 @@ class JsonFormatSpec extends Specification {
user = apiUser,
body= "Me too",
created_at= date1,
updated_at= date1)(RepositoryName("octocat","Hello-World"), 100, IssueOrPullRequest(false))
updated_at= date1)(RepositoryName("octocat","Hello-World"), 100, false)
val apiCommentJson = s"""{
"id": 1,
"body": "Me too",
@@ -105,7 +105,7 @@ class JsonFormatSpec extends Specification {
user = apiUser,
body= "Me too",
created_at= date1,
updated_at= date1)(RepositoryName("octocat","Hello-World"), 100, IssueOrPullRequest(true))
updated_at= date1)(RepositoryName("octocat","Hello-World"), 100, true)
val apiCommentPRJson = s"""{
"id": 1,
"body": "Me too",
@@ -173,7 +173,7 @@ class JsonFormatSpec extends Specification {
state = "open",
body = "I'm having a problem with this.",
created_at = date1,
updated_at = date1)(RepositoryName("octocat","Hello-World"), IssueOrPullRequest(false))
updated_at = date1)(RepositoryName("octocat","Hello-World"), false)
val apiIssueJson = s"""{
"number": 1347,
"state": "open",
@@ -193,7 +193,7 @@ class JsonFormatSpec extends Specification {
state = "open",
body = "I'm having a problem with this.",
created_at = date1,
updated_at = date1)(RepositoryName("octocat","Hello-World"), IssueOrPullRequest(true))
updated_at = date1)(RepositoryName("octocat","Hello-World"), true)
val apiIssuePRJson = s"""{
"number": 1347,
"state": "open",