mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
[CHORE] Cleanup dependency
- Remove `gitea.com/lunny/dingtalk_webhook` as dependency, we only use two structs which are small enough to be recreated in Forgejo and don't need to rely on the dependency. - Existing tests (thanks @oliverpool) prove that this has no effect.
This commit is contained in:
parent
91b8874acf
commit
f579bde69d
4 changed files with 17 additions and 13 deletions
5
assets/go-licenses.json
generated
5
assets/go-licenses.json
generated
File diff suppressed because one or more lines are too long
1
go.mod
1
go.mod
|
@ -12,7 +12,6 @@ require (
|
|||
gitea.com/go-chi/cache v0.2.0
|
||||
gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098
|
||||
gitea.com/go-chi/session v0.0.0-20240316035857-16768d98ec96
|
||||
gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
|
||||
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4
|
||||
github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
|
||||
|
|
2
go.sum
2
go.sum
|
@ -62,8 +62,6 @@ gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098 h1:p2ki+WK0cIeNQuqjR
|
|||
gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098/go.mod h1:LjzIOHlRemuUyO7WR12fmm18VZIlCAaOt9L3yKw40pk=
|
||||
gitea.com/go-chi/session v0.0.0-20240316035857-16768d98ec96 h1:IFDiMBObsP6CZIRaDLd54SR6zPYAffPXiXck5Xslu0Q=
|
||||
gitea.com/go-chi/session v0.0.0-20240316035857-16768d98ec96/go.mod h1:0iEpFKnwO5dG0aF98O4eq6FMsAiXkNBaDIlUOlq4BtM=
|
||||
gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 h1:+wWBi6Qfruqu7xJgjOIrKVQGiLUZdpKYCZewJ4clqhw=
|
||||
gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96/go.mod h1:VyMQP6ue6MKHM8UsOXfNfuMKD0oSAWZdXVcpHIN2yaY=
|
||||
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4 h1:IFT+hup2xejHqdhS7keYWioqfmxdnfblFDTGoOwcZ+o=
|
||||
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4/go.mod h1:HBqmLbz56JWpfEGG0prskAV97ATNRoj5LDmPicD22hU=
|
||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
|
||||
|
|
|
@ -16,8 +16,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/util"
|
||||
webhook_module "code.gitea.io/gitea/modules/webhook"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
||||
dingtalk "gitea.com/lunny/dingtalk_webhook"
|
||||
)
|
||||
|
||||
type dingtalkHandler struct{}
|
||||
|
@ -42,8 +40,22 @@ func (dingtalkHandler) FormFields(bind func(any)) FormFields {
|
|||
}
|
||||
|
||||
type (
|
||||
// DingtalkPayload represents
|
||||
DingtalkPayload dingtalk.Payload
|
||||
// DingtalkPayload represents an dingtalk payload.
|
||||
DingtalkPayload struct {
|
||||
MsgType string `json:"msgtype"`
|
||||
Text struct {
|
||||
Content string `json:"content"`
|
||||
} `json:"text"`
|
||||
ActionCard DingtalkActionCard `json:"actionCard"`
|
||||
}
|
||||
|
||||
DingtalkActionCard struct {
|
||||
Text string `json:"text"`
|
||||
Title string `json:"title"`
|
||||
HideAvatar string `json:"hideAvatar"`
|
||||
SingleTitle string `json:"singleTitle"`
|
||||
SingleURL string `json:"singleURL"`
|
||||
}
|
||||
)
|
||||
|
||||
// Create implements PayloadConvertor Create method
|
||||
|
@ -195,7 +207,7 @@ func (dc dingtalkConvertor) Package(p *api.PackagePayload) (DingtalkPayload, err
|
|||
func createDingtalkPayload(title, text, singleTitle, singleURL string) DingtalkPayload {
|
||||
return DingtalkPayload{
|
||||
MsgType: "actionCard",
|
||||
ActionCard: dingtalk.ActionCard{
|
||||
ActionCard: DingtalkActionCard{
|
||||
Text: strings.TrimSpace(text),
|
||||
Title: strings.TrimSpace(title),
|
||||
HideAvatar: "0",
|
||||
|
|
Loading…
Reference in a new issue