summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-10 03:57:58 +0800
committerGitHub <noreply@github.com>2021-11-09 20:57:58 +0100
commit99b2858e628d92bba252be72def409af77af735b (patch)
tree56159cf10b271307911e6f01626c0c3efba789ab /models/user.go
parentb6b1e716654fec3b16d245ef65cf42e57e1bb5b6 (diff)
downloadgitea-99b2858e628d92bba252be72def409af77af735b.tar.gz
gitea-99b2858e628d92bba252be72def409af77af735b.zip
Move unit into models/unit/ (#17576)
* Move unit into models/unit/ * Rename unit.UnitType as unit.Type
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/models/user.go b/models/user.go
index dde5d0e180..bf4444802f 100644
--- a/models/user.go
+++ b/models/user.go
@@ -22,6 +22,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/login"
+ "code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
@@ -559,7 +560,7 @@ func (u *User) GetRepositories(listOpts db.ListOptions, names ...string) (err er
// GetRepositoryIDs returns repositories IDs where user owned and has unittypes
// Caller shall check that units is not globally disabled
-func (u *User) GetRepositoryIDs(units ...UnitType) ([]int64, error) {
+func (u *User) GetRepositoryIDs(units ...unit.Type) ([]int64, error) {
var ids []int64
sess := db.GetEngine(db.DefaultContext).Table("repository").Cols("repository.id")
@@ -574,7 +575,7 @@ func (u *User) GetRepositoryIDs(units ...UnitType) ([]int64, error) {
// GetActiveRepositoryIDs returns non-archived repositories IDs where user owned and has unittypes
// Caller shall check that units is not globally disabled
-func (u *User) GetActiveRepositoryIDs(units ...UnitType) ([]int64, error) {
+func (u *User) GetActiveRepositoryIDs(units ...unit.Type) ([]int64, error) {
var ids []int64
sess := db.GetEngine(db.DefaultContext).Table("repository").Cols("repository.id")
@@ -591,7 +592,7 @@ func (u *User) GetActiveRepositoryIDs(units ...UnitType) ([]int64, error) {
// GetOrgRepositoryIDs returns repositories IDs where user's team owned and has unittypes
// Caller shall check that units is not globally disabled
-func (u *User) GetOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
+func (u *User) GetOrgRepositoryIDs(units ...unit.Type) ([]int64, error) {
var ids []int64
if err := db.GetEngine(db.DefaultContext).Table("repository").
@@ -612,7 +613,7 @@ func (u *User) GetOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
// GetActiveOrgRepositoryIDs returns non-archived repositories IDs where user's team owned and has unittypes
// Caller shall check that units is not globally disabled
-func (u *User) GetActiveOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
+func (u *User) GetActiveOrgRepositoryIDs(units ...unit.Type) ([]int64, error) {
var ids []int64
if err := db.GetEngine(db.DefaultContext).Table("repository").
@@ -634,7 +635,7 @@ func (u *User) GetActiveOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
// GetAccessRepoIDs returns all repositories IDs where user's or user is a team member organizations
// Caller shall check that units is not globally disabled
-func (u *User) GetAccessRepoIDs(units ...UnitType) ([]int64, error) {
+func (u *User) GetAccessRepoIDs(units ...unit.Type) ([]int64, error) {
ids, err := u.GetRepositoryIDs(units...)
if err != nil {
return nil, err
@@ -648,7 +649,7 @@ func (u *User) GetAccessRepoIDs(units ...UnitType) ([]int64, error) {
// GetActiveAccessRepoIDs returns all non-archived repositories IDs where user's or user is a team member organizations
// Caller shall check that units is not globally disabled
-func (u *User) GetActiveAccessRepoIDs(units ...UnitType) ([]int64, error) {
+func (u *User) GetActiveAccessRepoIDs(units ...unit.Type) ([]int64, error) {
ids, err := u.GetActiveRepositoryIDs(units...)
if err != nil {
return nil, err