1
0
Fork 0
forked from forgejo/forgejo

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:
Lunny Xiao 2021-11-24 17:49:20 +08:00 committed by GitHub
parent 4e7ca946da
commit a666829a37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
345 changed files with 4230 additions and 3813 deletions

View file

@ -8,6 +8,7 @@ import (
"fmt"
"code.gitea.io/gitea/models/db"
user_model "code.gitea.io/gitea/models/user"
)
// ActionList defines a list of actions
@ -23,13 +24,13 @@ func (actions ActionList) getUserIDs() []int64 {
return keysInt64(userIDs)
}
func (actions ActionList) loadUsers(e db.Engine) ([]*User, error) {
func (actions ActionList) loadUsers(e db.Engine) ([]*user_model.User, error) {
if len(actions) == 0 {
return nil, nil
}
userIDs := actions.getUserIDs()
userMaps := make(map[int64]*User, len(userIDs))
userMaps := make(map[int64]*user_model.User, len(userIDs))
err := e.
In("id", userIDs).
Find(&userMaps)
@ -44,7 +45,7 @@ func (actions ActionList) loadUsers(e db.Engine) ([]*User, error) {
}
// LoadUsers loads actions' all users
func (actions ActionList) LoadUsers() ([]*User, error) {
func (actions ActionList) LoadUsers() ([]*user_model.User, error) {
return actions.loadUsers(db.GetEngine(db.DefaultContext))
}