mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 06:25:51 +01:00
Merge pull request #1144 from distkloc/pull-request-key-in-issues-api
Add pull_request key in list issues api if an issue is a pull request
This commit is contained in:
@@ -20,6 +20,16 @@ case class ApiIssue(
|
|||||||
body: String)(repositoryName: RepositoryName, isPullRequest: Boolean){
|
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}/${if(isPullRequest){ "pull" }else{ "issues" }}/${number}")
|
val html_url = ApiPath(s"/${repositoryName.fullName}/${if(isPullRequest){ "pull" }else{ "issues" }}/${number}")
|
||||||
|
val pull_request = if (isPullRequest) {
|
||||||
|
Some(Map(
|
||||||
|
"url" -> ApiPath(s"/api/v3/repos/${repositoryName.fullName}/pulls/${number}"),
|
||||||
|
"html_url" -> ApiPath(s"/${repositoryName.fullName}/pull/${number}")
|
||||||
|
// "diff_url" -> ApiPath(s"/${repositoryName.fullName}/pull/${number}.diff"),
|
||||||
|
// "patch_url" -> ApiPath(s"/${repositoryName.fullName}/pull/${number}.patch")
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ApiIssue{
|
object ApiIssue{
|
||||||
|
|||||||
@@ -252,6 +252,12 @@ class JsonFormatSpec extends FunSuite {
|
|||||||
"user": $apiUserJson,
|
"user": $apiUserJson,
|
||||||
"comments_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347/comments",
|
"comments_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347/comments",
|
||||||
"html_url": "${context.baseUrl}/octocat/Hello-World/pull/1347",
|
"html_url": "${context.baseUrl}/octocat/Hello-World/pull/1347",
|
||||||
|
"pull_request": {
|
||||||
|
"url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/1347",
|
||||||
|
"html_url": "${context.baseUrl}/octocat/Hello-World/pull/1347"
|
||||||
|
// "diff_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.diff",
|
||||||
|
// "patch_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.patch"
|
||||||
|
},
|
||||||
"created_at": "2011-04-14T16:00:49Z",
|
"created_at": "2011-04-14T16:00:49Z",
|
||||||
"updated_at": "2011-04-14T16:00:49Z"
|
"updated_at": "2011-04-14T16:00:49Z"
|
||||||
}"""
|
}"""
|
||||||
|
|||||||
Reference in New Issue
Block a user