aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/org/teams.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-10-20 05:23:31 +0200
committerGitHub <noreply@github.com>2022-10-20 11:23:31 +0800
commitbd272e416ab40112f1f8bfb71669feeea48ee674 (patch)
tree3a69749d028cb13cb1d45244c66d238f532c39d6 /routers/web/org/teams.go
parentfe442dba4bb09bdc6f92acbe9bb3dee1f5bbf74a (diff)
downloadgitea-bd272e416ab40112f1f8bfb71669feeea48ee674.tar.gz
gitea-bd272e416ab40112f1f8bfb71669feeea48ee674.zip
move invite by mail to services package (#21513)
followup #20307 close #21511 -> make it easy to also add API equivalent later ...
Diffstat (limited to 'routers/web/org/teams.go')
-rw-r--r--routers/web/org/teams.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go
index bcdbcbe079..399d07fe47 100644
--- a/routers/web/org/teams.go
+++ b/routers/web/org/teams.go
@@ -27,7 +27,6 @@ import (
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/utils"
"code.gitea.io/gitea/services/forms"
- "code.gitea.io/gitea/services/mailer"
org_service "code.gitea.io/gitea/services/org"
)
@@ -132,8 +131,7 @@ func TeamsAction(ctx *context.Context) {
if err != nil {
if user_model.IsErrUserNotExist(err) {
if setting.MailService != nil && user_model.ValidateEmail(uname) == nil {
- invite, err := org_model.CreateTeamInvite(ctx, ctx.Doer, ctx.Org.Team, uname)
- if err != nil {
+ if err := org_service.CreateTeamInvite(ctx, ctx.Doer, ctx.Org.Team, uname); err != nil {
if org_model.IsErrTeamInviteAlreadyExist(err) {
ctx.Flash.Error(ctx.Tr("form.duplicate_invite_to_team"))
} else if org_model.IsErrUserEmailAlreadyAdded(err) {
@@ -142,9 +140,6 @@ func TeamsAction(ctx *context.Context) {
ctx.ServerError("CreateTeamInvite", err)
return
}
- } else if err := mailer.MailTeamInvite(ctx, ctx.Doer, ctx.Org.Team, invite); err != nil {
- ctx.ServerError("MailTeamInvite", err)
- return
}
} else {
ctx.Flash.Error(ctx.Tr("form.user_not_exist"))