mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08: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:
		@@ -9,12 +9,18 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/modules/setting"
 | 
			
		||||
	"code.gitea.io/gitea/modules/templates"
 | 
			
		||||
	"code.gitea.io/gitea/modules/translation"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// SendRepoTransferNotifyMail triggers a notification e-mail when a pending repository transfer was created
 | 
			
		||||
func SendRepoTransferNotifyMail(doer, newOwner *models.User, repo *models.Repository) error {
 | 
			
		||||
	if setting.MailService == nil {
 | 
			
		||||
		// No mail service configured
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if newOwner.IsOrganization() {
 | 
			
		||||
		users, err := models.GetUsersWhoCanCreateOrgRepo(newOwner.ID)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user