Make icon optional

If not set, will be an identicon later
This commit is contained in:
Melody Becker 2025-04-05 22:00:17 +02:00
parent 5a032d2007
commit 9fdb57407b
No known key found for this signature in database

View file

@ -6,8 +6,6 @@ import (
"gorm.io/gen"
"gorm.io/gorm"
"git.mstar.dev/mstar/linstrom/config"
)
// A user describes an account for creating content and events.
@ -44,8 +42,8 @@ type User struct {
DisplayName string // The display name of the user. Can be different from the handle
Description string // The description of a user account
IsBot bool // Whether to mark this account as a script controlled one
Icon MediaMetadata
IconId string // ID of a media file used as icon
Icon *MediaMetadata
IconId sql.NullString // ID of a media file used as icon
Background *MediaMetadata
BackgroundId sql.NullString // ID of a media file used as background image
Banner *MediaMetadata
@ -68,6 +66,7 @@ type User struct {
// saved space is worth
PasskeyId []byte
FinishedRegistration bool // Whether this account has completed registration yet
PrivateKey []byte
// ---- "Remote" linked values
InfoFields []UserInfoField
@ -80,25 +79,6 @@ type User struct {
AuthMethods []UserAuthMethod
}
func BuildLinstromUser() *User {
server := BuildDefaultServer()
return &User{
ID: "e3f4bb33-6d39-4349-b13e-f5c6fde56141",
Username: "linstrom",
Server: *server,
ServerId: server.ID,
DisplayName: config.GlobalConfig.Self.ServerActorDisplayName,
Description: "The default linstrom server user",
IsBot: true,
Icon: DefaultDuckMedia,
IconId: DefaultDuckMedia.ID,
Background: nil,
BackgroundId: sql.NullString{Valid: false},
Banner: nil,
BannerId: sql.NullString{Valid: false},
}
}
type IUser interface {
// Get a user by a username
//