mirror of
https://github.com/go-gitea/gitea
synced 2024-12-30 17:15:58 +01: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,12 +550,20 @@ 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...)
|
||||||
|
|
||||||
src := user.RealSizedAvatarLink(size * models.AvatarRenderedSizeFactor)
|
if user, ok := item.(*models.User); ok {
|
||||||
if src != "" {
|
src := user.RealSizedAvatarLink(size * models.AvatarRenderedSizeFactor)
|
||||||
return AvatarHTML(src, size, class, user.DisplayName())
|
if src != "" {
|
||||||
|
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 New Issue
Block a user