feat(agents): align create name defaults
This commit is contained in:
@@ -142,6 +142,12 @@ func (r *AgentRepo) CreateAgent(ctx context.Context, accountID uint, inviterID u
|
||||
err := r.db.WithContext(ctx).Where("email = ?", email).First(&user).Error
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
// Create new user
|
||||
if name == "" {
|
||||
name = email
|
||||
if atIdx := indexOfAt(email); atIdx > 0 {
|
||||
name = email[:atIdx]
|
||||
}
|
||||
}
|
||||
user = model.User{
|
||||
Name: name,
|
||||
Email: email,
|
||||
|
||||
Reference in New Issue
Block a user