feat: make the new inbox project the default
This commit is contained in:
parent
9111db2a16
commit
0110f93313
@ -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
|
// CreateNewProjectForUser creates a new inbox project for a user. To prevent import cycles, we can't do that
|
||||||
// directly in the user.Create function.
|
// 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{
|
p := &Project{
|
||||||
Title: "Inbox",
|
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) {
|
func UpdateProject(s *xorm.Session, project *Project, auth web.Auth, updateProjectBackground bool) (err error) {
|
||||||
|
@ -87,7 +87,7 @@ func CreateUser(s *xorm.Session, user *User) (newUser *User, err error) {
|
|||||||
return nil, err
|
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 {
|
if !config.MailerEnabled.GetBool() || user.Issuer != IssuerLocal {
|
||||||
return newUserOut, err
|
return newUserOut, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user