aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/webhook.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-07-25 00:03:58 +0800
committerGitHub <noreply@github.com>2021-07-24 18:03:58 +0200
commit9f31f3aa8ac4f6bfc8390c9ae63b2a387b414c88 (patch)
tree6f27dc68a35d1f9d806c632e36f0edc8543184ea /routers/web/repo/webhook.go
parente0f9635c0691cb67f0fcbb758cabba801d9fc51b (diff)
downloadgitea-9f31f3aa8ac4f6bfc8390c9ae63b2a387b414c88.tar.gz
gitea-9f31f3aa8ac4f6bfc8390c9ae63b2a387b414c88.zip
Add an abstract json layout to make it's easier to change json library (#16528)
* Add an abstract json layout to make it's easier to change json library * Fix import * Fix import sequence * Fix blank lines * Fix blank lines
Diffstat (limited to 'routers/web/repo/webhook.go')
-rw-r--r--routers/web/repo/webhook.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go
index 30fa98f809..946801cb76 100644
--- a/routers/web/repo/webhook.go
+++ b/routers/web/repo/webhook.go
@@ -17,13 +17,13 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/git"
+ "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/services/forms"
"code.gitea.io/gitea/services/webhook"
- jsoniter "github.com/json-iterator/go"
)
const (
@@ -306,7 +306,6 @@ func DiscordHooksNewPost(ctx *context.Context) {
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
meta, err := json.Marshal(&webhook.DiscordMeta{
Username: form.Username,
IconURL: form.IconURL,
@@ -402,7 +401,6 @@ func TelegramHooksNewPost(ctx *context.Context) {
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
meta, err := json.Marshal(&webhook.TelegramMeta{
BotToken: form.BotToken,
ChatID: form.ChatID,
@@ -455,7 +453,6 @@ func MatrixHooksNewPost(ctx *context.Context) {
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
meta, err := json.Marshal(&webhook.MatrixMeta{
HomeserverURL: form.HomeserverURL,
Room: form.RoomID,
@@ -560,7 +557,6 @@ func SlackHooksNewPost(ctx *context.Context) {
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
meta, err := json.Marshal(&webhook.SlackMeta{
Channel: strings.TrimSpace(form.Channel),
Username: form.Username,
@@ -848,7 +844,6 @@ func SlackHooksEditPost(ctx *context.Context) {
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
meta, err := json.Marshal(&webhook.SlackMeta{
Channel: strings.TrimSpace(form.Channel),
Username: form.Username,
@@ -894,7 +889,6 @@ func DiscordHooksEditPost(ctx *context.Context) {
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
meta, err := json.Marshal(&webhook.DiscordMeta{
Username: form.Username,
IconURL: form.IconURL,
@@ -970,7 +964,7 @@ func TelegramHooksEditPost(ctx *context.Context) {
ctx.HTML(http.StatusOK, orCtx.NewTemplate)
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
+
meta, err := json.Marshal(&webhook.TelegramMeta{
BotToken: form.BotToken,
ChatID: form.ChatID,
@@ -1012,7 +1006,7 @@ func MatrixHooksEditPost(ctx *context.Context) {
ctx.HTML(http.StatusOK, orCtx.NewTemplate)
return
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
+
meta, err := json.Marshal(&webhook.MatrixMeta{
HomeserverURL: form.HomeserverURL,
Room: form.RoomID,