0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-13 11:44:56 +02:00

[misc] update avatar utils to handle group avatars

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-01-09 19:40:08 -05:00
parent e7fa8649c4
commit 7f3e776867
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C

View File

@ -4,6 +4,7 @@
package templates
import (
group_model "code.gitea.io/gitea/models/group"
"context"
"html"
"html/template"
@ -55,6 +56,11 @@ func (au *AvatarUtils) Avatar(item any, others ...any) template.HTML {
if src != "" {
return AvatarHTML(src, size, class, t.AsUser().DisplayName())
}
case *group_model.Group:
src := t.AvatarLinkWithSize(size * setting.Avatar.RenderedSizeFactor)
if src != "" {
return AvatarHTML(src, size, class, t.Name)
}
}
return AvatarHTML(avatars.DefaultAvatarLink(), size, class, "")