mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Move user related model into models/user (#17781)
* Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
@@ -93,7 +94,7 @@ func createTag(gitRepo *git.Repository, rel *models.Release, msg string) (bool,
|
||||
}
|
||||
|
||||
if rel.PublisherID <= 0 {
|
||||
u, err := models.GetUserByEmail(commit.Author.Email)
|
||||
u, err := user_model.GetUserByEmail(commit.Author.Email)
|
||||
if err == nil {
|
||||
rel.PublisherID = u.ID
|
||||
}
|
||||
@@ -136,7 +137,7 @@ func CreateRelease(gitRepo *git.Repository, rel *models.Release, attachmentUUIDs
|
||||
}
|
||||
|
||||
// CreateNewTag creates a new repository tag
|
||||
func CreateNewTag(doer *models.User, repo *models.Repository, commit, tagName, msg string) error {
|
||||
func CreateNewTag(doer *user_model.User, repo *models.Repository, commit, tagName, msg string) error {
|
||||
isExist, err := models.IsReleaseExist(repo.ID, tagName)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -179,7 +180,7 @@ func CreateNewTag(doer *models.User, repo *models.Repository, commit, tagName, m
|
||||
// addAttachmentUUIDs accept a slice of new created attachments' uuids which will be reassigned release_id as the created release
|
||||
// delAttachmentUUIDs accept a slice of attachments' uuids which will be deleted from the release
|
||||
// editAttachments accept a map of attachment uuid to new attachment name which will be updated with attachments.
|
||||
func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Release,
|
||||
func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *models.Release,
|
||||
addAttachmentUUIDs, delAttachmentUUIDs []string, editAttachments map[string]string) (err error) {
|
||||
if rel.ID == 0 {
|
||||
return errors.New("UpdateRelease only accepts an exist release")
|
||||
@@ -278,7 +279,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea
|
||||
}
|
||||
|
||||
// DeleteReleaseByID deletes a release and corresponding Git tag by given ID.
|
||||
func DeleteReleaseByID(id int64, doer *models.User, delTag bool) error {
|
||||
func DeleteReleaseByID(id int64, doer *user_model.User, delTag bool) error {
|
||||
rel, err := models.GetReleaseByID(id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("GetReleaseByID: %v", err)
|
||||
|
Reference in New Issue
Block a user