aboutsummaryrefslogtreecommitdiffstats
path: root/services/convert/convert.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/convert/convert.go')
-rw-r--r--services/convert/convert.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/services/convert/convert.go b/services/convert/convert.go
index 756a1f95d9..a8329f5285 100644
--- a/services/convert/convert.go
+++ b/services/convert/convert.go
@@ -22,13 +22,11 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
- "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/gitdiff"
- webhook_service "code.gitea.io/gitea/services/webhook"
)
// ToEmail convert models.EmailAddress to api.Email
@@ -242,38 +240,6 @@ func ToGPGKeyEmail(email *user_model.EmailAddress) *api.GPGKeyEmail {
}
}
-// ToHook convert models.Webhook to api.Hook
-func ToHook(repoLink string, w *webhook.Webhook) (*api.Hook, error) {
- config := map[string]string{
- "url": w.URL,
- "content_type": w.ContentType.Name(),
- }
- if w.Type == webhook.SLACK {
- s := webhook_service.GetSlackHook(w)
- config["channel"] = s.Channel
- config["username"] = s.Username
- config["icon_url"] = s.IconURL
- config["color"] = s.Color
- }
-
- authorizationHeader, err := w.HeaderAuthorization()
- if err != nil {
- return nil, err
- }
-
- return &api.Hook{
- ID: w.ID,
- Type: w.Type,
- URL: fmt.Sprintf("%s/settings/hooks/%d", repoLink, w.ID),
- Active: w.IsActive,
- Config: config,
- Events: w.EventsArray(),
- AuthorizationHeader: authorizationHeader,
- Updated: w.UpdatedUnix.AsTime(),
- Created: w.CreatedUnix.AsTime(),
- }, nil
-}
-
// ToGitHook convert git.Hook to api.GitHook
func ToGitHook(h *git.Hook) *api.GitHook {
return &api.GitHook{