forked from kevadesu/forgejo
Move webhook into models/webhook/ (#17579)
This commit is contained in:
parent
edbaa5d3f0
commit
33fca2b537
47 changed files with 770 additions and 717 deletions
|
@ -14,11 +14,12 @@ import (
|
|||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/login"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
"code.gitea.io/gitea/models/webhook"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/services/webhook"
|
||||
webhook_service "code.gitea.io/gitea/services/webhook"
|
||||
)
|
||||
|
||||
// ToEmail convert models.EmailAddress to api.Email
|
||||
|
@ -226,13 +227,13 @@ func ToGPGKeyEmail(email *models.EmailAddress) *api.GPGKeyEmail {
|
|||
}
|
||||
|
||||
// ToHook convert models.Webhook to api.Hook
|
||||
func ToHook(repoLink string, w *models.Webhook) *api.Hook {
|
||||
func ToHook(repoLink string, w *webhook.Webhook) *api.Hook {
|
||||
config := map[string]string{
|
||||
"url": w.URL,
|
||||
"content_type": w.ContentType.Name(),
|
||||
}
|
||||
if w.Type == models.SLACK {
|
||||
s := webhook.GetSlackHook(w)
|
||||
if w.Type == webhook.SLACK {
|
||||
s := webhook_service.GetSlackHook(w)
|
||||
config["channel"] = s.Channel
|
||||
config["username"] = s.Username
|
||||
config["icon_url"] = s.IconURL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue