Move EmailAddress & UserRedirect into models/user/ (#17607)
* Move EmailAddress into models/user/ * Fix test * rename user_mail to user_email * Fix test * Move UserRedirect into models/user/ * Fix lint & test * Fix lint * Fix lint * remove nolint comment * Fix lint
This commit is contained in:
parent
492e1c2fbd
commit
90eb9fb889
32 changed files with 722 additions and 647 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
)
|
||||
|
||||
// Organization contains organization context
|
||||
|
@ -51,10 +52,10 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
|
|||
ctx.Org.Organization, err = models.GetUserByName(orgName)
|
||||
if err != nil {
|
||||
if models.IsErrUserNotExist(err) {
|
||||
redirectUserID, err := models.LookupUserRedirect(orgName)
|
||||
redirectUserID, err := user_model.LookupUserRedirect(orgName)
|
||||
if err == nil {
|
||||
RedirectToUser(ctx, orgName, redirectUserID)
|
||||
} else if models.IsErrUserRedirectNotExist(err) {
|
||||
} else if user_model.IsErrUserRedirectNotExist(err) {
|
||||
ctx.NotFound("GetUserByName", err)
|
||||
} else {
|
||||
ctx.ServerError("LookupUserRedirect", err)
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/login"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/models/webhook"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -23,7 +24,7 @@ import (
|
|||
)
|
||||
|
||||
// ToEmail convert models.EmailAddress to api.Email
|
||||
func ToEmail(email *models.EmailAddress) *api.Email {
|
||||
func ToEmail(email *user_model.EmailAddress) *api.Email {
|
||||
return &api.Email{
|
||||
Email: email.Email,
|
||||
Verified: email.IsActivated,
|
||||
|
@ -219,7 +220,7 @@ func ToGPGKey(key *models.GPGKey) *api.GPGKey {
|
|||
}
|
||||
|
||||
// ToGPGKeyEmail convert models.EmailAddress to api.GPGKeyEmail
|
||||
func ToGPGKeyEmail(email *models.EmailAddress) *api.GPGKeyEmail {
|
||||
func ToGPGKeyEmail(email *user_model.EmailAddress) *api.GPGKeyEmail {
|
||||
return &api.GPGKeyEmail{
|
||||
Email: email.Email,
|
||||
Verified: email.IsActivated,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue