code.gitea.io/gitea@v1.21.7/services/org/team_invite.go (about)

     1  // Copyright 2022 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package org
     5  
     6  import (
     7  	"context"
     8  
     9  	org_model "code.gitea.io/gitea/models/organization"
    10  	user_model "code.gitea.io/gitea/models/user"
    11  	"code.gitea.io/gitea/services/mailer"
    12  )
    13  
    14  // CreateTeamInvite make a persistent invite in db and mail it
    15  func CreateTeamInvite(ctx context.Context, inviter *user_model.User, team *org_model.Team, uname string) error {
    16  	invite, err := org_model.CreateTeamInvite(ctx, inviter, team, uname)
    17  	if err != nil {
    18  		return err
    19  	}
    20  
    21  	return mailer.MailTeamInvite(ctx, inviter, team, invite)
    22  }