@@ -569,10 +569,19 @@ func safeURL(address string) string { | |||||
} | } | ||||
type ContributorInfo struct { | type ContributorInfo struct { | ||||
UserInfo *models.User | |||||
Email string // for contributor who is not a registered user | |||||
UserInfo *models.User // nil for contributor who is not a registered user | |||||
Email string | |||||
CommitCnt int | |||||
} | } | ||||
func getContributorInfo(contributorInfos []*ContributorInfo, email string) *ContributorInfo{ | |||||
for _, c := range contributorInfos { | |||||
if strings.Compare(c.Email,email) == 0 { | |||||
return c | |||||
} | |||||
} | |||||
return nil | |||||
} | |||||
// Home render repository home page | // Home render repository home page | ||||
func Home(ctx *context.Context) { | func Home(ctx *context.Context) { | ||||
if len(ctx.Repo.Units) > 0 { | if len(ctx.Repo.Units) > 0 { | ||||
@@ -583,12 +592,17 @@ func Home(ctx *context.Context) { | |||||
for _, c := range contributors { | for _, c := range contributors { | ||||
user, err := models.GetUserByEmail(c.Email) | user, err := models.GetUserByEmail(c.Email) | ||||
if err == nil { | if err == nil { | ||||
contributorInfos = append(contributorInfos, &ContributorInfo{ | |||||
user, c.Email, | |||||
}) | |||||
existedContributorInfo := getContributorInfo(contributorInfos,user.Email) | |||||
if existedContributorInfo != nil { | |||||
existedContributorInfo.CommitCnt += c.CommitCnt | |||||
}else{ | |||||
contributorInfos = append(contributorInfos, &ContributorInfo{ | |||||
user, user.Email,c.CommitCnt, | |||||
}) | |||||
} | |||||
} else { | } else { | ||||
contributorInfos = append(contributorInfos, &ContributorInfo{ | contributorInfos = append(contributorInfos, &ContributorInfo{ | ||||
nil, c.Email, | |||||
nil, c.Email,c.CommitCnt, | |||||
}) | }) | ||||
} | } | ||||
} | } | ||||
@@ -104,6 +104,21 @@ func CreateUser(ctx *context.Context, form api.CreateUserOption) { | |||||
} | } | ||||
return | return | ||||
} | } | ||||
err := models.AddEmailAddress(&models.EmailAddress{ | |||||
UID: u.ID, | |||||
Email: form.Email, | |||||
IsActivated: !setting.Service.RegisterEmailConfirm, | |||||
}) | |||||
if err != nil { | |||||
log.Error("AddEmailAddress failed:%v", err.Error(), ctx.Data["MsgID"]) | |||||
ctx.JSON(http.StatusInternalServerError, map[string]string{ | |||||
"error_msg": err.Error(), | |||||
}) | |||||
return | |||||
} | |||||
log.Trace("Account created (%s): %s", ctx.User.Name, u.Name, ctx.Data["MsgID"]) | log.Trace("Account created (%s): %s", ctx.User.Name, u.Name, ctx.Data["MsgID"]) | ||||
// Send email notification. | // Send email notification. | ||||
@@ -1165,7 +1165,19 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo | |||||
} | } | ||||
return | return | ||||
} | } | ||||
log.Trace("Account created: %s", u.Name) | |||||
log.Trace("Account created: %s", u.Name, ctx.Data["MsgID"]) | |||||
err := models.AddEmailAddress(&models.EmailAddress{ | |||||
UID: u.ID, | |||||
Email: form.Email, | |||||
IsActivated: !setting.Service.RegisterEmailConfirm, | |||||
}) | |||||
if err != nil { | |||||
log.Error("AddEmailAddress failed:%v", err.Error(), ctx.Data["MsgID"]) | |||||
ctx.ServerError("AddEmailAddress", err) | |||||
return | |||||
} | |||||
// Auto-set admin for the only user. | // Auto-set admin for the only user. | ||||
if models.CountUsers() == 1 { | if models.CountUsers() == 1 { | ||||
@@ -2685,7 +2685,7 @@ tbody.commit-list { | |||||
width: 1127px; | width: 1127px; | ||||
} | } | ||||
th .message-wrapper { | th .message-wrapper { | ||||
max-width: 680px; | |||||
max-width: 510px; | |||||
} | } | ||||
} | } | ||||