diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-02-02 20:33:36 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-02 20:33:36 +0800 |
commit | d7d094bd8a5520b758f34d3fb0439c6a1ddb39d3 (patch) | |
tree | f8ba37fee85af46ad98b815fa70574ad3dbec9f2 /models/user.go | |
parent | 2db0ffe69ef80def358b96ff2c3804c79c9174c3 (diff) | |
download | gitea-d7d094bd8a5520b758f34d3fb0439c6a1ddb39d3.tar.gz gitea-d7d094bd8a5520b758f34d3fb0439c6a1ddb39d3.zip |
fix: ignore email notifications if user is not active. (#820)
Diffstat (limited to 'models/user.go')
-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 306b695bf3..7d4f536242 100644 --- a/models/user.go +++ b/models/user.go @@ -537,6 +537,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, @@ -1047,7 +1053,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 } |