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:
@@ -14,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
@@ -63,13 +64,13 @@ type Action struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
UserID int64 `xorm:"INDEX"` // Receiver user id.
|
||||
OpType ActionType
|
||||
ActUserID int64 `xorm:"INDEX"` // Action user id.
|
||||
ActUser *User `xorm:"-"`
|
||||
RepoID int64 `xorm:"INDEX"`
|
||||
Repo *Repository `xorm:"-"`
|
||||
CommentID int64 `xorm:"INDEX"`
|
||||
Comment *Comment `xorm:"-"`
|
||||
IsDeleted bool `xorm:"INDEX NOT NULL DEFAULT false"`
|
||||
ActUserID int64 `xorm:"INDEX"` // Action user id.
|
||||
ActUser *user_model.User `xorm:"-"`
|
||||
RepoID int64 `xorm:"INDEX"`
|
||||
Repo *Repository `xorm:"-"`
|
||||
CommentID int64 `xorm:"INDEX"`
|
||||
Comment *Comment `xorm:"-"`
|
||||
IsDeleted bool `xorm:"INDEX NOT NULL DEFAULT false"`
|
||||
RefName string
|
||||
IsPrivate bool `xorm:"INDEX NOT NULL DEFAULT false"`
|
||||
Content string `xorm:"TEXT"`
|
||||
@@ -91,11 +92,11 @@ func (a *Action) LoadActUser() {
|
||||
return
|
||||
}
|
||||
var err error
|
||||
a.ActUser, err = GetUserByID(a.ActUserID)
|
||||
a.ActUser, err = user_model.GetUserByID(a.ActUserID)
|
||||
if err == nil {
|
||||
return
|
||||
} else if IsErrUserNotExist(err) {
|
||||
a.ActUser = NewGhostUser()
|
||||
} else if user_model.IsErrUserNotExist(err) {
|
||||
a.ActUser = user_model.NewGhostUser()
|
||||
} else {
|
||||
log.Error("GetUserByID(%d): %v", a.ActUserID, err)
|
||||
}
|
||||
@@ -294,13 +295,13 @@ func (a *Action) GetIssueContent() string {
|
||||
|
||||
// GetFeedsOptions options for retrieving feeds
|
||||
type GetFeedsOptions struct {
|
||||
RequestedUser *User // the user we want activity for
|
||||
RequestedTeam *Team // the team we want activity for
|
||||
Actor *User // the user viewing the activity
|
||||
IncludePrivate bool // include private actions
|
||||
OnlyPerformedBy bool // only actions performed by requested user
|
||||
IncludeDeleted bool // include deleted actions
|
||||
Date string // the day we want activity for: YYYY-MM-DD
|
||||
RequestedUser *user_model.User // the user we want activity for
|
||||
RequestedTeam *Team // the team we want activity for
|
||||
Actor *user_model.User // the user viewing the activity
|
||||
IncludePrivate bool // include private actions
|
||||
OnlyPerformedBy bool // only actions performed by requested user
|
||||
IncludeDeleted bool // include deleted actions
|
||||
Date string // the day we want activity for: YYYY-MM-DD
|
||||
}
|
||||
|
||||
// GetFeeds returns actions according to the provided options
|
||||
@@ -327,7 +328,7 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) {
|
||||
return actions, nil
|
||||
}
|
||||
|
||||
func activityReadable(user, doer *User) bool {
|
||||
func activityReadable(user, doer *user_model.User) bool {
|
||||
var doerID int64
|
||||
if doer != nil {
|
||||
doerID = doer.ID
|
||||
|
Reference in New Issue
Block a user