feat(agents): align create name defaults

This commit is contained in:
2026-06-06 02:26:42 +08:00
parent 3c30596bad
commit dd2bdee470
4 changed files with 47 additions and 6 deletions
+6
View File
@@ -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,