fix: fallback to username if chars in name are not supported for avatars

This commit is contained in:
Elias Schneider
2026-10-11 00:54:58 +02:00
parent 3355b656b5
commit e2cacac193
6 changed files with 95 additions and 75 deletions
-11
View File
@@ -8,7 +8,6 @@ import (
"github.com/go-webauthn/webauthn/webauthn"
datatype "github.com/pocket-id/pocket-id/backend/internal/model/types"
"github.com/pocket-id/pocket-id/backend/internal/utils"
)
type User struct {
@@ -88,16 +87,6 @@ func (u User) FullName() string {
return u.Username
}
func (u User) Initials() string {
first := utils.GetFirstCharacter(u.FirstName)
last := utils.GetFirstCharacter(u.LastName)
if first != "" || last != "" {
return strings.ToUpper(first + last)
}
return strings.ToUpper(utils.GetFirstCharacter(u.Username))
}
func (u User) LastModified() time.Time {
if u.UpdatedAt != nil {
return u.UpdatedAt.ToTime()