diff options
author | 6543 <6543@obermui.de> | 2022-10-20 05:23:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-20 11:23:31 +0800 |
commit | bd272e416ab40112f1f8bfb71669feeea48ee674 (patch) | |
tree | 3a69749d028cb13cb1d45244c66d238f532c39d6 /services/org | |
parent | fe442dba4bb09bdc6f92acbe9bb3dee1f5bbf74a (diff) | |
download | gitea-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 'services/org')
-rw-r--r-- | services/org/team_invite.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/services/org/team_invite.go b/services/org/team_invite.go new file mode 100644 index 0000000000..1108a46da5 --- /dev/null +++ b/services/org/team_invite.go @@ -0,0 +1,23 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package org + +import ( + "context" + + org_model "code.gitea.io/gitea/models/organization" + user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/services/mailer" +) + +// CreateTeamInvite make a persistent invite in db and mail it +func CreateTeamInvite(ctx context.Context, inviter *user_model.User, team *org_model.Team, uname string) error { + invite, err := org_model.CreateTeamInvite(ctx, inviter, team, uname) + if err != nil { + return err + } + + return mailer.MailTeamInvite(ctx, inviter, team, invite) +} |