diff options
author | Joe Chen <jc@unknwon.io> | 2023-02-04 12:22:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-04 12:22:37 +0800 |
commit | ed51686240ff84e3cc12be8bc4311c529d44faee (patch) | |
tree | e8cdbc9a2870d1143e81b2524626bfd04ea6d1c7 /internal/db/user.go | |
parent | cc4d4eacad6b6a92ebb3380715dcaee3bcc5fd41 (diff) |
refactor(db): migrate methods off `user.go` (#7333)
Diffstat (limited to 'internal/db/user.go')
-rw-r--r-- | internal/db/user.go | 24 |
1 files changed, 0 insertions, 24 deletions
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) |