aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-07 12:56:40 -0400
committerUnknown <joe2010xtmf@163.com>2014-04-07 12:56:40 -0400
commit9ea9818d3255e5b08293205e278240dece36687d (patch)
tree51c6a65586843082f451ee1e93082fec5784ccd2 /models
parent05fb34eacdbec59fb8bcdf96c82c0855e6ec78d2 (diff)
downloadgitea-9ea9818d3255e5b08293205e278240dece36687d.tar.gz
gitea-9ea9818d3255e5b08293205e278240dece36687d.zip
Fix issue with log in with GitHub but need more error handle after
Diffstat (limited to 'models')
-rw-r--r--models/user.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index a5a6de097f..0fcf72437e 100644
--- a/models/user.go
+++ b/models/user.go
@@ -366,6 +366,19 @@ func GetUserByName(name string) (*User, error) {
return user, nil
}
+// GetUserEmailsByNames returns a slice of e-mails corresponds to names.
+func GetUserEmailsByNames(names []string) []string {
+ mails := make([]string, 0, len(names))
+ for _, name := range names {
+ u, err := GetUserByName(name)
+ if err != nil {
+ continue
+ }
+ mails = append(mails, u.Email)
+ }
+ return mails
+}
+
// GetUserByEmail returns the user object by given e-mail if exists.
func GetUserByEmail(email string) (*User, error) {
if len(email) == 0 {