diff options
author | Renato P. de Aquino <renato.aquino@gmail.com> | 2017-01-30 11:35:12 -0200 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2017-01-30 08:35:12 -0500 |
commit | ec5a967937a8dd4fb5287591e8dedcdedfa2b32d (patch) | |
tree | cb27ce2c4a55f9d18ca17d218a0b52463189a71f /models | |
parent | 4bc98f7aa2b94a18ddaef26f64ae01c2d38fb552 (diff) |
Issue #3814 (#3903)
Diffstat (limited to 'models')
-rw-r--r-- | models/user.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/models/user.go b/models/user.go index 18221756..e69a6798 100644 --- a/models/user.go +++ b/models/user.go @@ -469,6 +469,12 @@ func (u *User) ShortName(length int) string { return base.EllipsisString(u.Name, length) } +// IsMailable checks if a user is elegible +// to receive emails. +func (u *User) IsMailable() bool { + return u.IsActive +} + // IsUserExist checks if given user name exist, // the user name should be noncased unique. // If uid is presented, then check will rule out that one, @@ -929,7 +935,9 @@ func GetUserEmailsByNames(names []string) []string { if err != nil { continue } - mails = append(mails, u.Email) + if u.IsMailable() { + mails = append(mails, u.Email) + } } return mails } |