[REFACTOR] webhook shared code to prevent import cycles

This commit is contained in:
oliverpool 2024-04-03 14:22:36 +02:00
parent c4adb08d6d
commit 04a398a1af
17 changed files with 232 additions and 211 deletions

View file

@ -6,9 +6,7 @@ package webhook
import (
"fmt"
"html"
"html/template"
"net/url"
"strconv"
"strings"
webhook_model "code.gitea.io/gitea/models/webhook"
@ -354,9 +352,3 @@ func ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) {
Created: w.CreatedUnix.AsTime(),
}, nil
}
func imgIcon(name string, size int) template.HTML {
s := strconv.Itoa(size)
src := html.EscapeString(setting.StaticURLPrefix + "/assets/img/" + name)
return template.HTML(`<img width="` + s + `" height="` + s + `" src="` + src + `">`)
}