forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move invite by mail to services package (go-gitea#21513)
followup go-gitea#20307 close go-gitea#21511 -> make it easy to also add API equivalent later ...
- Loading branch information
6543
authored
Oct 20, 2022
1 parent
fe442db
commit bd272e4
Showing
2 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |