mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 22:45:51 +01:00
(refs #920) Remove IssueOrPullRequest. it is too much for this purpose
This commit is contained in:
@@ -14,8 +14,8 @@ case class ApiComment(
|
|||||||
user: ApiUser,
|
user: ApiUser,
|
||||||
body: String,
|
body: String,
|
||||||
created_at: Date,
|
created_at: Date,
|
||||||
updated_at: Date)(repositoryName: RepositoryName, issueId: Int, issueOrPullRequest: IssueOrPullRequest){
|
updated_at: Date)(repositoryName: RepositoryName, issueId: Int, isPullRequest: Boolean){
|
||||||
val html_url = ApiPath(s"/${repositoryName.fullName}/${issueOrPullRequest.path}/${issueId}#comment-${id}")
|
val html_url = ApiPath(s"/${repositoryName.fullName}/${if(isPullRequest){ "pull" }else{ "issues" }}/${issueId}#comment-${id}")
|
||||||
}
|
}
|
||||||
|
|
||||||
object ApiComment{
|
object ApiComment{
|
||||||
@@ -25,5 +25,5 @@ object ApiComment{
|
|||||||
user = user,
|
user = user,
|
||||||
body = comment.content,
|
body = comment.content,
|
||||||
created_at = comment.registeredDate,
|
created_at = comment.registeredDate,
|
||||||
updated_at = comment.updatedDate)(repositoryName, issueId, IssueOrPullRequest(isPullRequest))
|
updated_at = comment.updatedDate)(repositoryName, issueId, isPullRequest)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ case class ApiIssue(
|
|||||||
state: String,
|
state: String,
|
||||||
created_at: Date,
|
created_at: Date,
|
||||||
updated_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 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{
|
object ApiIssue{
|
||||||
@@ -31,5 +31,5 @@ object ApiIssue{
|
|||||||
state = if(issue.closed){ "closed" }else{ "open" },
|
state = if(issue.closed){ "closed" }else{ "open" },
|
||||||
body = issue.content.getOrElse(""),
|
body = issue.content.getOrElse(""),
|
||||||
created_at = issue.registeredDate,
|
created_at = issue.registeredDate,
|
||||||
updated_at = issue.updatedDate)(repositoryName, IssueOrPullRequest(issue.isPullRequest))
|
updated_at = issue.updatedDate)(repositoryName, issue.isPullRequest)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package gitbucket.core.api
|
|
||||||
|
|
||||||
case class IssueOrPullRequest(isPullRequest:Boolean){
|
|
||||||
val path = if(isPullRequest){ "pull" }else{ "issues" }
|
|
||||||
}
|
|
||||||
@@ -90,7 +90,7 @@ class JsonFormatSpec extends Specification {
|
|||||||
user = apiUser,
|
user = apiUser,
|
||||||
body= "Me too",
|
body= "Me too",
|
||||||
created_at= date1,
|
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"""{
|
val apiCommentJson = s"""{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"body": "Me too",
|
"body": "Me too",
|
||||||
@@ -105,7 +105,7 @@ class JsonFormatSpec extends Specification {
|
|||||||
user = apiUser,
|
user = apiUser,
|
||||||
body= "Me too",
|
body= "Me too",
|
||||||
created_at= date1,
|
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"""{
|
val apiCommentPRJson = s"""{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"body": "Me too",
|
"body": "Me too",
|
||||||
@@ -173,7 +173,7 @@ class JsonFormatSpec extends Specification {
|
|||||||
state = "open",
|
state = "open",
|
||||||
body = "I'm having a problem with this.",
|
body = "I'm having a problem with this.",
|
||||||
created_at = date1,
|
created_at = date1,
|
||||||
updated_at = date1)(RepositoryName("octocat","Hello-World"), IssueOrPullRequest(false))
|
updated_at = date1)(RepositoryName("octocat","Hello-World"), false)
|
||||||
val apiIssueJson = s"""{
|
val apiIssueJson = s"""{
|
||||||
"number": 1347,
|
"number": 1347,
|
||||||
"state": "open",
|
"state": "open",
|
||||||
@@ -193,7 +193,7 @@ class JsonFormatSpec extends Specification {
|
|||||||
state = "open",
|
state = "open",
|
||||||
body = "I'm having a problem with this.",
|
body = "I'm having a problem with this.",
|
||||||
created_at = date1,
|
created_at = date1,
|
||||||
updated_at = date1)(RepositoryName("octocat","Hello-World"), IssueOrPullRequest(true))
|
updated_at = date1)(RepositoryName("octocat","Hello-World"), true)
|
||||||
val apiIssuePRJson = s"""{
|
val apiIssuePRJson = s"""{
|
||||||
"number": 1347,
|
"number": 1347,
|
||||||
"state": "open",
|
"state": "open",
|
||||||
|
|||||||
Reference in New Issue
Block a user