mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 01:34:27 +00:00 
			
		
		
		
	Page: Commits and fix #249
This commit is contained in:
		@@ -522,15 +522,21 @@ type UserCommit struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// ValidCommitsWithEmails checks if authors' e-mails of commits are correcponding to users.
 | 
					// ValidCommitsWithEmails checks if authors' e-mails of commits are correcponding to users.
 | 
				
			||||||
func ValidCommitsWithEmails(oldCommits *list.List) *list.List {
 | 
					func ValidCommitsWithEmails(oldCommits *list.List) *list.List {
 | 
				
			||||||
 | 
						emails := map[string]string{}
 | 
				
			||||||
	newCommits := list.New()
 | 
						newCommits := list.New()
 | 
				
			||||||
	e := oldCommits.Front()
 | 
						e := oldCommits.Front()
 | 
				
			||||||
	for e != nil {
 | 
						for e != nil {
 | 
				
			||||||
		c := e.Value.(*git.Commit)
 | 
							c := e.Value.(*git.Commit)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		uname := ""
 | 
							uname := ""
 | 
				
			||||||
		u, err := GetUserByEmail(c.Author.Email)
 | 
							if v, ok := emails[c.Author.Email]; !ok {
 | 
				
			||||||
		if err == nil {
 | 
								u, err := GetUserByEmail(c.Author.Email)
 | 
				
			||||||
			uname = u.Name
 | 
								if err == nil {
 | 
				
			||||||
 | 
									uname = u.Name
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								emails[c.Author.Email] = uname
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								uname = v
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		newCommits.PushBack(UserCommit{
 | 
							newCommits.PushBack(UserCommit{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user