@ -28,13 +28,13 @@ func SendRepoTransferNotifyMail(ctx context.Context, doer, newOwner *user_model.
return err
return err
}
}
langMap := make ( map [ string ] [ ] string )
langMap := make ( map [ string ] [ ] * user_model . User )
for _ , user := range users {
for _ , user := range users {
if ! user . IsActive {
if ! user . IsActive {
// don't send emails to inactive users
// don't send emails to inactive users
continue
continue
}
}
langMap [ user . Language ] = append ( langMap [ user . Language ] , user . Email )
langMap [ user . Language ] = append ( langMap [ user . Language ] , user )
}
}
for lang , tos := range langMap {
for lang , tos := range langMap {
@ -46,11 +46,11 @@ func SendRepoTransferNotifyMail(ctx context.Context, doer, newOwner *user_model.
return nil
return nil
}
}
return sendRepoTransferNotifyMailPerLang ( newOwner . Language , newOwner , doer , [ ] string { newOwner . Email } , repo )
return sendRepoTransferNotifyMailPerLang ( newOwner . Language , newOwner , doer , [ ] * user_model . User { newOwner } , repo )
}
}
// sendRepoTransferNotifyMail triggers a notification e-mail when a pending repository transfer was created for each language
// sendRepoTransferNotifyMail triggers a notification e-mail when a pending repository transfer was created for each language
func sendRepoTransferNotifyMailPerLang ( lang string , newOwner , doer * user_model . User , emails [ ] string , repo * repo_model . Repository ) error {
func sendRepoTransferNotifyMailPerLang ( lang string , newOwner , doer * user_model . User , emailTo s [ ] * user_model . User , repo * repo_model . Repository ) error {
var (
var (
locale = translation . NewLocale ( lang )
locale = translation . NewLocale ( lang )
content bytes . Buffer
content bytes . Buffer
@ -78,8 +78,8 @@ func sendRepoTransferNotifyMailPerLang(lang string, newOwner, doer *user_model.U
return err
return err
}
}
for _ , to := range emails {
for _ , to := range emailTo s {
msg := NewMessage ( to , subject , content . String ( ) )
msg := NewMessage ( to . EmailTo ( ) , subject , content . String ( ) )
msg . Info = fmt . Sprintf ( "UID: %d, repository pending transfer notification" , newOwner . ID )
msg . Info = fmt . Sprintf ( "UID: %d, repository pending transfer notification" , newOwner . ID )
SendAsync ( msg )
SendAsync ( msg )