fix minor issue in error.go
This commit is contained in:
parent
93abfc41fc
commit
959811ae31
2 changed files with 4 additions and 8 deletions
|
@ -1106,7 +1106,7 @@ func IsErrTeamsDoNotExist(err error) bool {
|
|||
}
|
||||
|
||||
func (err ErrTeamsDoNotExist) Error() string {
|
||||
return fmt.Sprintf("Team does not exist [Team ID: %d]", err.Name)
|
||||
return fmt.Sprintf("Team does not exist [Team Name: %v]", err.Name)
|
||||
}
|
||||
|
||||
// ErrCodeTeamDoesNotExist holds the unique world-error code of this error
|
||||
|
|
|
@ -200,7 +200,7 @@ func HandleCallback(c echo.Context) error {
|
|||
}
|
||||
|
||||
// Check if we have seen this user before
|
||||
teams := GetOrCreateTeamsByNames(s, cl.Group, u)
|
||||
teams, err := GetOrCreateTeamsByNames(s, cl.Group, u)
|
||||
if err != nil {
|
||||
log.Errorf("Error verifying team for name %v, got %v", cl.Name, teams, err)
|
||||
return err
|
||||
|
@ -227,10 +227,7 @@ func HandleCallback(c echo.Context) error {
|
|||
return auth.NewUserAuthTokenResponse(u, c, false)
|
||||
}
|
||||
|
||||
func GetOrCreateTeamsByNames(s *xorm.Session, teamNames []string, u *user.User) (te []models.Team) {
|
||||
// Check if a team with given name exists should be after user creation
|
||||
|
||||
//TODO: 1. Create team if not exist
|
||||
func GetOrCreateTeamsByNames(s *xorm.Session, teamNames []string, u *user.User) (te []models.Team, err error) {
|
||||
te = []models.Team{}
|
||||
for _, t := range teamNames {
|
||||
team, err := models.GetTeamsByName(s, t)
|
||||
|
@ -240,7 +237,6 @@ func GetOrCreateTeamsByNames(s *xorm.Session, teamNames []string, u *user.User)
|
|||
tea := &models.Team{
|
||||
Name: t,
|
||||
}
|
||||
// TODO: here the user who creates the Team is automatically admin. That shoud not be the case..?
|
||||
err := tea.CreateNoAdmin(s, u)
|
||||
if err != nil {
|
||||
log.Errorf("Teams: %v, err: %v", tea, err)
|
||||
|
@ -256,7 +252,7 @@ func GetOrCreateTeamsByNames(s *xorm.Session, teamNames []string, u *user.User)
|
|||
}
|
||||
}
|
||||
}
|
||||
return te
|
||||
return te, err
|
||||
}
|
||||
|
||||
// assign user to team
|
||||
|
|
Loading…
Reference in a new issue