From ed51686240ff84e3cc12be8bc4311c529d44faee Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sat, 4 Feb 2023 12:22:37 +0800 Subject: refactor(db): migrate methods off `user.go` (#7333) --- internal/db/user.go | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'internal/db/user.go') diff --git a/internal/db/user.go b/internal/db/user.go index 1048a2eb..17e0f66b 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -200,36 +200,12 @@ func DeleteInactivateUsers() (err error) { return err } -// GetUserEmailsByNames returns a list of e-mails corresponds to names. -func GetUserEmailsByNames(names []string) []string { - mails := make([]string, 0, len(names)) - for _, name := range names { - u, err := Users.GetByUsername(context.TODO(), name) - if err != nil { - continue - } - if u.IsMailable() { - mails = append(mails, u.Email) - } - } - return mails -} - // UserCommit represents a commit with validation of user. type UserCommit struct { User *User *git.Commit } -// ValidateCommitWithEmail checks if author's e-mail of commit is corresponding to a user. -func ValidateCommitWithEmail(c *git.Commit) *User { - u, err := Users.GetByEmail(context.TODO(), c.Author.Email) - if err != nil { - return nil - } - return u -} - // ValidateCommitsWithEmails checks if authors' e-mails of commits are corresponding to users. func ValidateCommitsWithEmails(oldCommits []*git.Commit) []*UserCommit { emails := make(map[string]*User) -- cgit v1.2.3