Return default avatar url when user id is zero rather than updating database (#34094)

(cherry picked from commit 88352e0b252e9186a5633d39124a8a65ab89f831)
This commit is contained in:
Lunny Xiao 2025-04-01 18:03:27 -07:00 committed by Michael Jerger
parent 39341df8cb
commit 02d9c7cd27

View file

@ -62,7 +62,7 @@ func GenerateRandomAvatar(ctx context.Context, u *User) error {
// AvatarLinkWithSize returns a link to the user's avatar with size. size <= 0 means default size
func (u *User) AvatarLinkWithSize(ctx context.Context, size int) string {
if u.IsGhost() {
if u.IsGhost() || u.ID <= 0 {
return avatars.DefaultAvatarLink()
}