diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-08-30 12:31:33 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-08-30 07:31:33 +0300 |
commit | 5de94a67cf09ae21254269058d86f71fe05ea243 (patch) | |
tree | c513645ae0024ccec3d93bd1466315fce473cf80 /models/user.go | |
parent | edc817a1dcb5a65fceb9d2da17288b6c4ce18147 (diff) | |
download | gitea-5de94a67cf09ae21254269058d86f71fe05ea243.tar.gz gitea-5de94a67cf09ae21254269058d86f71fe05ea243.zip |
some refactors for issue and comments (#2419)
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go index bbdec74525..01f14edb7f 100644 --- a/models/user.go +++ b/models/user.go @@ -1144,11 +1144,15 @@ func GetAssigneeByID(repo *Repository, userID int64) (*User, error) { // GetUserByName returns user by given name. func GetUserByName(name string) (*User, error) { + return getUserByName(x, name) +} + +func getUserByName(e Engine, name string) (*User, error) { if len(name) == 0 { return nil, ErrUserNotExist{0, name, 0} } u := &User{LowerName: strings.ToLower(name)} - has, err := x.Get(u) + has, err := e.Get(u) if err != nil { return nil, err } else if !has { @@ -1159,9 +1163,13 @@ func GetUserByName(name string) (*User, error) { // GetUserEmailsByNames returns a list of e-mails corresponds to names. func GetUserEmailsByNames(names []string) []string { + return getUserEmailsByNames(x, names) +} + +func getUserEmailsByNames(e Engine, names []string) []string { mails := make([]string, 0, len(names)) for _, name := range names { - u, err := GetUserByName(name) + u, err := getUserByName(e, name) if err != nil { continue } |