Add newlines for readability

This commit is contained in:
erik 2023-12-21 09:30:07 +01:00 committed by Michael Jerger
parent fff4c3f9fc
commit 715afb2468

View file

@ -214,8 +214,8 @@ func createUserFromAP(ctx *context.APIContext, personId forgefed.PersonId) (*use
if err != nil { if err != nil {
return &user_model.User{}, err return &user_model.User{}, err
} }
log.Info("RepositoryInbox: got person by ap: %v", person) log.Info("RepositoryInbox: got person by ap: %v", person)
email := fmt.Sprintf("%v@%v", uuid.New().String(), personId.Host) email := fmt.Sprintf("%v@%v", uuid.New().String(), personId.Host)
loginName := personId.AsLoginName() loginName := personId.AsLoginName()
name := fmt.Sprintf("%v%v", person.PreferredUsername.String(), personId.HostSuffix()) name := fmt.Sprintf("%v%v", person.PreferredUsername.String(), personId.HostSuffix())
@ -224,10 +224,12 @@ func createUserFromAP(ctx *context.APIContext, personId forgefed.PersonId) (*use
if len(person.Name) == 0 { if len(person.Name) == 0 {
fullName = name fullName = name
} }
password, err := pwd_gen.Generate(32, 10, 10, false, true) password, err := pwd_gen.Generate(32, 10, 10, false, true)
if err != nil { if err != nil {
return &user_model.User{}, err return &user_model.User{}, err
} }
user := &user_model.User{ user := &user_model.User{
LowerName: strings.ToLower(person.PreferredUsername.String()), LowerName: strings.ToLower(person.PreferredUsername.String()),
Name: name, Name: name,
@ -240,10 +242,12 @@ func createUserFromAP(ctx *context.APIContext, personId forgefed.PersonId) (*use
Type: user_model.UserTypeRemoteUser, Type: user_model.UserTypeRemoteUser,
IsAdmin: false, IsAdmin: false,
} }
overwrite := &user_model.CreateUserOverwriteOptions{ overwrite := &user_model.CreateUserOverwriteOptions{
IsActive: util.OptionalBoolFalse, IsActive: util.OptionalBoolFalse,
IsRestricted: util.OptionalBoolFalse, IsRestricted: util.OptionalBoolFalse,
} }
if err := user_model.CreateUser(ctx, user, overwrite); err != nil { if err := user_model.CreateUser(ctx, user, overwrite); err != nil {
return &user_model.User{}, err return &user_model.User{}, err
} }