1
0
Fork 0
forked from forgejo/forgejo

[REFACTOR] add Icon to webhook.Interface

This commit is contained in:
oliverpool 2024-03-22 16:02:48 +01:00 committed by GitHub
parent 7f03fdf9f9
commit 84eeab59af
15 changed files with 54 additions and 2 deletions

View file

@ -6,7 +6,9 @@ package webhook
import (
"fmt"
"html"
"html/template"
"net/url"
"strconv"
"strings"
webhook_model "code.gitea.io/gitea/models/webhook"
@ -352,3 +354,9 @@ 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 + `">`)
}