mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 12:22:11 +00:00
Send registration email on user autoregistration (#16523)
When users login and are autoregistered send email notification. Fix #16178 * Protect public functions within the mailer by testing if the mailer is configured Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
e29e163737
commit
162c32af7e
10 changed files with 88 additions and 3 deletions
|
@ -7,10 +7,16 @@ package mailer
|
|||
import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
||||
// MailParticipantsComment sends new comment emails to repository watchers and mentioned people.
|
||||
func MailParticipantsComment(c *models.Comment, opType models.ActionType, issue *models.Issue, mentions []*models.User) error {
|
||||
if setting.MailService == nil {
|
||||
// No mail service configured
|
||||
return nil
|
||||
}
|
||||
|
||||
content := c.Content
|
||||
if c.Type == models.CommentTypePullPush {
|
||||
content = ""
|
||||
|
@ -30,6 +36,11 @@ func MailParticipantsComment(c *models.Comment, opType models.ActionType, issue
|
|||
|
||||
// MailMentionsComment sends email to users mentioned in a code comment
|
||||
func MailMentionsComment(pr *models.PullRequest, c *models.Comment, mentions []*models.User) (err error) {
|
||||
if setting.MailService == nil {
|
||||
// No mail service configured
|
||||
return nil
|
||||
}
|
||||
|
||||
visited := make(map[int64]bool, len(mentions)+1)
|
||||
visited[c.Poster.ID] = true
|
||||
if err = mailIssueCommentBatch(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue