mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 19:15:59 +01:00
Merge pull request #1955 from kounoike/pr-improve-payload-for-discord
Improve webhook payload compatibility for discord.
This commit is contained in:
@@ -18,6 +18,7 @@ case class ApiIssue(
|
||||
updated_at: Date,
|
||||
body: String
|
||||
)(repositoryName: RepositoryName, isPullRequest: Boolean) {
|
||||
val id = 0 // dummy id
|
||||
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 pull_request = if (isPullRequest) {
|
||||
|
||||
@@ -23,6 +23,7 @@ case class ApiPullRequest(
|
||||
labels: List[ApiLabel],
|
||||
assignee: Option[ApiUser]
|
||||
) {
|
||||
val id = 0 // dummy id
|
||||
val html_url = ApiPath(s"${base.repo.html_url.path}/pull/${number}")
|
||||
//val diff_url = ApiPath(s"${base.repo.html_url.path}/pull/${number}.diff")
|
||||
//val patch_url = ApiPath(s"${base.repo.html_url.path}/pull/${number}.patch")
|
||||
|
||||
@@ -14,6 +14,7 @@ case class ApiRepository(
|
||||
default_branch: String,
|
||||
owner: ApiUser
|
||||
)(urlIsHtmlUrl: Boolean) {
|
||||
val id = 0 // dummy id
|
||||
val forks_count = forks
|
||||
val watchers_count = watchers
|
||||
val url = if (urlIsHtmlUrl) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import gitbucket.core.model.Account
|
||||
import java.util.Date
|
||||
|
||||
case class ApiUser(login: String, email: String, `type`: String, site_admin: Boolean, created_at: Date) {
|
||||
val id = 0 // dummy id
|
||||
val url = ApiPath(s"/api/v3/users/${login}")
|
||||
val html_url = ApiPath(s"/${login}")
|
||||
val avatar_url = ApiPath(s"/${login}/_avatar")
|
||||
|
||||
@@ -30,6 +30,7 @@ class JsonFormatSpec extends FunSuite {
|
||||
"email":"octocat@example.com",
|
||||
"type":"User",
|
||||
"site_admin":false,
|
||||
"id": 0,
|
||||
"created_at":"2011-04-14T16:00:49Z",
|
||||
"url":"http://gitbucket.exmple.com/api/v3/users/octocat",
|
||||
"html_url":"http://gitbucket.exmple.com/octocat",
|
||||
@@ -50,6 +51,7 @@ class JsonFormatSpec extends FunSuite {
|
||||
"name" : "Hello-World",
|
||||
"full_name" : "octocat/Hello-World",
|
||||
"description" : "This your first repo!",
|
||||
"id": 0,
|
||||
"watchers" : 0,
|
||||
"forks" : 0,
|
||||
"private" : false,
|
||||
@@ -228,6 +230,7 @@ class JsonFormatSpec extends FunSuite {
|
||||
"title": "Found a bug",
|
||||
"body": "I'm having a problem with this.",
|
||||
"user": $apiUserJson,
|
||||
"id": 0,
|
||||
"labels": [$apiLabelJson],
|
||||
"comments_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"html_url": "${context.baseUrl}/octocat/Hello-World/issues/1347",
|
||||
@@ -251,6 +254,7 @@ class JsonFormatSpec extends FunSuite {
|
||||
"title": "Found a bug",
|
||||
"body": "I'm having a problem with this.",
|
||||
"user": $apiUserJson,
|
||||
"id": 0,
|
||||
"labels": [$apiLabelJson],
|
||||
"comments_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"html_url": "${context.baseUrl}/octocat/Hello-World/pull/1347",
|
||||
@@ -285,6 +289,7 @@ class JsonFormatSpec extends FunSuite {
|
||||
val apiPullRequestJson = s"""{
|
||||
"number": 1347,
|
||||
"state" : "open",
|
||||
"id": 0,
|
||||
"updated_at": "2011-04-14T16:00:49Z",
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
// "closed_at": "2011-04-14T16:00:49Z",
|
||||
|
||||
Reference in New Issue
Block a user