aboutsummaryrefslogtreecommitdiff
path: root/internal/db/repo.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-11-05 23:33:05 +0800
committerGitHub <noreply@github.com>2022-11-05 23:33:05 +0800
commit5fb29db2db04bc128af410867f1f602320eb5d66 (patch)
tree9d0b86702d872f8f5ab7d0691e511c52f38fde34 /internal/db/repo.go
parentb5d47b969258f3d644ad797b29901eb607f6b94f (diff)
refactor(db): migrate methods off and delete deprecated methods from `user.go` (#7231)
Diffstat (limited to 'internal/db/repo.go')
-rw-r--r--internal/db/repo.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/db/repo.go b/internal/db/repo.go
index 81a6cd00..f9e19468 100644
--- a/internal/db/repo.go
+++ b/internal/db/repo.go
@@ -1310,12 +1310,12 @@ func FilterRepositoryWithIssues(repoIDs []int64) ([]int64, error) {
//
// Deprecated: Use repoutil.RepositoryPath instead.
func RepoPath(userName, repoName string) string {
- return filepath.Join(UserPath(userName), strings.ToLower(repoName)+".git")
+ return filepath.Join(repoutil.UserPath(userName), strings.ToLower(repoName)+".git")
}
// TransferOwnership transfers all corresponding setting from old user to new one.
func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error {
- newOwner, err := GetUserByName(newOwnerName)
+ newOwner, err := Users.GetByUsername(context.TODO(), newOwnerName)
if err != nil {
return fmt.Errorf("get new owner '%s': %v", newOwnerName, err)
}
@@ -1437,7 +1437,7 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
}
// Rename remote repository to new path and delete local copy.
- if err = os.MkdirAll(UserPath(newOwner.Name), os.ModePerm); err != nil {
+ if err = os.MkdirAll(repoutil.UserPath(newOwner.Name), os.ModePerm); err != nil {
return err
}
if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil {
@@ -1606,7 +1606,7 @@ func DeleteRepository(ownerID, repoID int64) error {
}
// In case is a organization.
- org, err := GetUserByID(ownerID)
+ org, err := Users.GetByID(context.TODO(), ownerID)
if err != nil {
return err
}
@@ -1724,7 +1724,7 @@ func GetRepositoryByRef(ref string) (*Repository, error) {
}
userName, repoName := ref[:n], ref[n+1:]
- user, err := GetUserByName(userName)
+ user, err := Users.GetByUsername(context.TODO(), userName)
if err != nil {
return nil, err
}