diff options
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/models/user.go b/models/user.go index a3679c9a5b..7aa1e143e8 100644 --- a/models/user.go +++ b/models/user.go @@ -1320,16 +1320,20 @@ func GetUsersByIDs(ids []int64) ([]*User, error) { } // GetUserIDsByNames returns a slice of ids corresponds to names. -func GetUserIDsByNames(names []string) []int64 { +func GetUserIDsByNames(names []string, ignoreNonExistent bool) ([]int64, error) { ids := make([]int64, 0, len(names)) for _, name := range names { u, err := GetUserByName(name) if err != nil { - continue + if ignoreNonExistent { + continue + } else { + return nil, err + } } ids = append(ids, u.ID) } - return ids + return ids, nil } // UserCommit represents a commit with validation of user. |