mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-20 23:49:23 +00:00
add ShortSha template func
This commit is contained in:
parent
3f65760739
commit
66b697a513
|
@ -33,6 +33,13 @@ func List(l *list.List) chan interface{} {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ShortSha(sha1 string) string {
|
||||||
|
if len(sha1) == 40 {
|
||||||
|
return sha1[:10]
|
||||||
|
}
|
||||||
|
return sha1
|
||||||
|
}
|
||||||
|
|
||||||
var mailDomains = map[string]string{
|
var mailDomains = map[string]string{
|
||||||
"gmail.com": "gmail.com",
|
"gmail.com": "gmail.com",
|
||||||
}
|
}
|
||||||
|
@ -72,4 +79,5 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
|
||||||
},
|
},
|
||||||
"DiffTypeToStr": DiffTypeToStr,
|
"DiffTypeToStr": DiffTypeToStr,
|
||||||
"DiffLineTypeToStr": DiffLineTypeToStr,
|
"DiffLineTypeToStr": DiffLineTypeToStr,
|
||||||
|
"ShortSha": ShortSha,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue