mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-17 17:04:38 -04:00
fix: ignore email notifications if user is not active. (#820)
This commit is contained in:
parent
2db0ffe69e
commit
d7d094bd8a
3 changed files with 62 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue