Extracting email functions into a service (#14802)
* Extracting email functions into a service * Fixing two shadowing errors * Address PR review comments Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
10f5a8890c
Коммит
b977017ca7
@@ -84,7 +84,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
auditRec.AddMeta("errors", errList)
|
||||
if len(goodEmails) > 0 {
|
||||
c.App.SendInviteEmails(team, "Administrator", "mmctl "+model.NewId(), goodEmails, *c.App.Config().ServiceSettings.SiteURL)
|
||||
c.App.Srv().EmailService.SendInviteEmails(team, "Administrator", "mmctl "+model.NewId(), goodEmails, *c.App.Config().ServiceSettings.SiteURL)
|
||||
}
|
||||
// in graceful mode we return both the successful ones and the failed ones
|
||||
w.Write([]byte(model.EmailInviteWithErrorToJson(invitesWithErrors)))
|
||||
@@ -101,7 +101,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
|
||||
c.Err = model.NewAppError("localInviteUsersToTeam", "api.team.invite_members.invalid_email.app_error", map[string]interface{}{"Addresses": s}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
c.App.SendInviteEmails(team, "Administrator", "mmctl "+model.NewId(), emailList, *c.App.Config().ServiceSettings.SiteURL)
|
||||
c.App.Srv().EmailService.SendInviteEmails(team, "Administrator", "mmctl "+model.NewId(), emailList, *c.App.Config().ServiceSettings.SiteURL)
|
||||
ReturnStatusOK(w)
|
||||
}
|
||||
auditRec.Success()
|
||||
|
||||
@@ -1185,7 +1185,7 @@ func updateUserActive(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if isSelfDeactive {
|
||||
c.App.Srv().Go(func() {
|
||||
if err = c.App.SendDeactivateAccountEmail(user.Email, user.Locale, c.App.GetSiteURL()); err != nil {
|
||||
if err = c.App.Srv().EmailService.SendDeactivateAccountEmail(user.Email, user.Locale, c.App.GetSiteURL()); err != nil {
|
||||
mlog.Error(err.Error())
|
||||
}
|
||||
})
|
||||
|
||||
@@ -3068,7 +3068,7 @@ func TestVerifyUserEmail(t *testing.T) {
|
||||
|
||||
ruser, _ := th.Client.CreateUser(&user)
|
||||
|
||||
token, err := th.App.CreateVerifyEmailToken(ruser.Id, email)
|
||||
token, err := th.App.Srv().EmailService.CreateVerifyEmailToken(ruser.Id, email)
|
||||
require.Nil(t, err, "Unable to create email verify token")
|
||||
|
||||
_, resp := th.Client.VerifyUserEmail(token.Token)
|
||||
|
||||
Ссылка в новой задаче
Block a user