mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-20 08:50:21 +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:
parent
4e7ca946da
commit
a666829a37
345 changed files with 4230 additions and 3813 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
@ -18,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
// appendPrivateInformation appends the owner and key type information to api.PublicKey
|
||||
func appendPrivateInformation(apiKey *api.PublicKey, key *models.PublicKey, defaultUser *models.User) (*api.PublicKey, error) {
|
||||
func appendPrivateInformation(apiKey *api.PublicKey, key *models.PublicKey, defaultUser *user_model.User) (*api.PublicKey, error) {
|
||||
if key.Type == models.KeyTypeDeploy {
|
||||
apiKey.KeyType = "deploy"
|
||||
} else if key.Type == models.KeyTypeUser {
|
||||
|
@ -27,7 +28,7 @@ func appendPrivateInformation(apiKey *api.PublicKey, key *models.PublicKey, defa
|
|||
if defaultUser.ID == key.OwnerID {
|
||||
apiKey.Owner = convert.ToUser(defaultUser, defaultUser)
|
||||
} else {
|
||||
user, err := models.GetUserByID(key.OwnerID)
|
||||
user, err := user_model.GetUserByID(key.OwnerID)
|
||||
if err != nil {
|
||||
return apiKey, err
|
||||
}
|
||||
|
@ -44,7 +45,7 @@ func composePublicKeysAPILink() string {
|
|||
return setting.AppURL + "api/v1/user/keys/"
|
||||
}
|
||||
|
||||
func listPublicKeys(ctx *context.APIContext, user *models.User) {
|
||||
func listPublicKeys(ctx *context.APIContext, user *user_model.User) {
|
||||
var keys []*models.PublicKey
|
||||
var err error
|
||||
var count int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue