Fix frontpage avatars (#13853)
The frontpage uses a rather strange method to obtain the commit's avatar which I've overlooked earlier. I don't exactly understand how it works but this change fixes the wrong default avatars by using the function that was in previous use. Also introduced a few constants for size an size increase factor. Fixes: https://github.com/go-gitea/gitea/issues/13844
This commit is contained in:
@ -118,12 +118,14 @@ func (pc *PushCommits) AvatarLink(email string) string {
|
||||
return avatar
|
||||
}
|
||||
|
||||
size := models.DefaultAvatarPixelSize * models.AvatarRenderedSizeFactor
|
||||
|
||||
u, ok := pc.emailUsers[email]
|
||||
if !ok {
|
||||
var err error
|
||||
u, err = models.GetUserByEmail(email)
|
||||
if err != nil {
|
||||
pc.avatars[email] = models.HashedAvatarLink(email)
|
||||
pc.avatars[email] = models.SizedAvatarLink(email, size)
|
||||
if !models.IsErrUserNotExist(err) {
|
||||
log.Error("GetUserByEmail: %v", err)
|
||||
return ""
|
||||
@ -133,7 +135,7 @@ func (pc *PushCommits) AvatarLink(email string) string {
|
||||
}
|
||||
}
|
||||
if u != nil {
|
||||
pc.avatars[email] = u.RelAvatarLink()
|
||||
pc.avatars[email] = u.RealSizedAvatarLink(size)
|
||||
}
|
||||
|
||||
return pc.avatars[email]
|
||||
|
Reference in New Issue
Block a user