feat: make the new inbox project the default

This commit is contained in:
kolaente 2023-03-25 15:00:35 +01:00
parent 9111db2a16
commit 0110f93313
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 14 additions and 3 deletions

View File

@ -714,11 +714,22 @@ func CreateProject(s *xorm.Session, project *Project, auth web.Auth) (err error)
// CreateNewProjectForUser creates a new inbox project for a user. To prevent import cycles, we can't do that
// directly in the user.Create function.
func CreateNewProjectForUser(s *xorm.Session, user *user.User) (err error) {
func CreateNewProjectForUser(s *xorm.Session, u *user.User) (err error) {
p := &Project{
Title: "Inbox",
}
return p.Create(s, user)
err = p.Create(s, u)
if err != nil {
return err
}
if u.DefaultProjectID != 0 {
return err
}
u.DefaultProjectID = p.ID
_, err = user.UpdateUser(s, u, false)
return err
}
func UpdateProject(s *xorm.Session, project *Project, auth web.Auth, updateProjectBackground bool) (err error) {

View File

@ -87,7 +87,7 @@ func CreateUser(s *xorm.Session, user *User) (newUser *User, err error) {
return nil, err
}
// Dont send a mail if no mailer is configured
// Don't send a mail if no mailer is configured
if !config.MailerEnabled.GetBool() || user.Issuer != IssuerLocal {
return newUserOut, err
}