diff options
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go index f327ed1440..8aa349c8a8 100644 --- a/models/user.go +++ b/models/user.go @@ -521,8 +521,17 @@ type UserCommit struct { *git.Commit } -// ValidCommitsWithEmails checks if authors' e-mails of commits are correcponding to users. -func ValidCommitsWithEmails(oldCommits *list.List) *list.List { +// ValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user. +func ValidateCommitWithEmail(c *git.Commit) (uname string) { + u, err := GetUserByEmail(c.Author.Email) + if err == nil { + uname = u.Name + } + return uname +} + +// ValidateCommitsWithEmails checks if authors' e-mails of commits are corresponding to users. +func ValidateCommitsWithEmails(oldCommits *list.List) *list.List { emails := map[string]string{} newCommits := list.New() e := oldCommits.Front() |