summaryrefslogtreecommitdiffstats
path: root/modules/repository/delete.go
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-09-25 15:17:37 +0200
committerGitHub <noreply@github.com>2023-09-25 13:17:37 +0000
commit7047df36d4c39fefa6464b713c66302aa0038123 (patch)
treea5c471a3e8abf5cabac8de42c0fd8a814df7abf1 /modules/repository/delete.go
parent93bd4351bfb4a2f5f37ecb80d50496d044240e00 (diff)
downloadgitea-7047df36d4c39fefa6464b713c66302aa0038123.tar.gz
gitea-7047df36d4c39fefa6464b713c66302aa0038123.zip
Another round of `db.DefaultContext` refactor (#27103)
Part of #27065 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Diffstat (limited to 'modules/repository/delete.go')
-rw-r--r--modules/repository/delete.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/repository/delete.go b/modules/repository/delete.go
index 72c0dc9135..43c52c933d 100644
--- a/modules/repository/delete.go
+++ b/modules/repository/delete.go
@@ -4,19 +4,20 @@
package repository
import (
- "code.gitea.io/gitea/models/db"
+ "context"
+
"code.gitea.io/gitea/models/organization"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
)
// CanUserDelete returns true if user could delete the repository
-func CanUserDelete(repo *repo_model.Repository, user *user_model.User) (bool, error) {
+func CanUserDelete(ctx context.Context, repo *repo_model.Repository, user *user_model.User) (bool, error) {
if user.IsAdmin || user.ID == repo.OwnerID {
return true, nil
}
- if err := repo.LoadOwner(db.DefaultContext); err != nil {
+ if err := repo.LoadOwner(ctx); err != nil {
return false, err
}