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