mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-30 12:21:06 +00:00
Fix avatar template error on repo collaborator page (#13924)
Fixes error `template: repo/settings/collaboration:16:16: executing "repo/settings/collaboration" at <.>: wrong type for value; expected *models.User; got *models.Collaborator` seen on repo collaborator page. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
338bfeebe7
commit
ccfa40889a
|
@ -550,13 +550,21 @@ func SVG(icon string, others ...interface{}) template.HTML {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avatar renders user avatars. args: user, size (int), class (string)
|
// Avatar renders user avatars. args: user, size (int), class (string)
|
||||||
func Avatar(user *models.User, others ...interface{}) template.HTML {
|
func Avatar(item interface{}, others ...interface{}) template.HTML {
|
||||||
size, class := parseOthers(models.DefaultAvatarPixelSize, "ui avatar image", others...)
|
size, class := parseOthers(models.DefaultAvatarPixelSize, "ui avatar image", others...)
|
||||||
|
|
||||||
|
if user, ok := item.(*models.User); ok {
|
||||||
src := user.RealSizedAvatarLink(size * models.AvatarRenderedSizeFactor)
|
src := user.RealSizedAvatarLink(size * models.AvatarRenderedSizeFactor)
|
||||||
if src != "" {
|
if src != "" {
|
||||||
return AvatarHTML(src, size, class, user.DisplayName())
|
return AvatarHTML(src, size, class, user.DisplayName())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if user, ok := item.(*models.Collaborator); ok {
|
||||||
|
src := user.RealSizedAvatarLink(size * models.AvatarRenderedSizeFactor)
|
||||||
|
if src != "" {
|
||||||
|
return AvatarHTML(src, size, class, user.DisplayName())
|
||||||
|
}
|
||||||
|
}
|
||||||
return template.HTML("")
|
return template.HTML("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue