summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2017-02-02 20:33:36 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-02 20:33:36 +0800
commitd7d094bd8a5520b758f34d3fb0439c6a1ddb39d3 (patch)
treef8ba37fee85af46ad98b815fa70574ad3dbec9f2 /models/user.go
parent2db0ffe69ef80def358b96ff2c3804c79c9174c3 (diff)
downloadgitea-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.go10
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
}