summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/admin
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-09-14 19:09:32 +0200
committerGitHub <noreply@github.com>2023-09-14 19:09:32 +0200
commit76659b1114153603050de810006e04a938e9dcb7 (patch)
treeed180213ca459bca51c44dbcc55fd3f9bc2d0460 /routers/api/v1/admin
parentRemove the useless function `GetUserIssueStats` and move relevant tests to `i... (diff)
downloadforgejo-76659b1114153603050de810006e04a938e9dcb7.tar.xz
forgejo-76659b1114153603050de810006e04a938e9dcb7.zip
Reduce usage of `db.DefaultContext` (#27073)
Part of #27065 This reduces the usage of `db.DefaultContext`. I think I've got enough files for the first PR. When this is merged, I will continue working on this. Considering how many files this PR affect, I hope it won't take to long to merge, so I don't end up in the merge conflict hell. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/api/v1/admin')
-rw-r--r--routers/api/v1/admin/email.go2
-rw-r--r--routers/api/v1/admin/org.go2
-rw-r--r--routers/api/v1/admin/user.go4
3 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/admin/email.go b/routers/api/v1/admin/email.go
index 8d0491e070..5914215bc2 100644
--- a/routers/api/v1/admin/email.go
+++ b/routers/api/v1/admin/email.go
@@ -37,7 +37,7 @@ func GetAllEmails(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)
- emails, maxResults, err := user_model.SearchEmails(&user_model.SearchEmailOptions{
+ emails, maxResults, err := user_model.SearchEmails(ctx, &user_model.SearchEmailOptions{
Keyword: ctx.Params(":email"),
ListOptions: listOptions,
})
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index 6d50a12674..65620459b7 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -101,7 +101,7 @@ func GetAllOrgs(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)
- users, maxResults, err := user_model.SearchUsers(&user_model.SearchUserOptions{
+ users, maxResults, err := user_model.SearchUsers(ctx, &user_model.SearchUserOptions{
Actor: ctx.Doer,
Type: user_model.UserTypeOrganization,
OrderBy: db.SearchOrderByAlphabetically,
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 4f1e9a3f53..66946e5797 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -128,7 +128,7 @@ func CreateUser(ctx *context.APIContext) {
u.UpdatedUnix = u.CreatedUnix
}
- if err := user_model.CreateUser(u, overwriteDefault); err != nil {
+ if err := user_model.CreateUser(ctx, u, overwriteDefault); err != nil {
if user_model.IsErrUserAlreadyExist(err) ||
user_model.IsErrEmailAlreadyUsed(err) ||
db.IsErrNameReserved(err) ||
@@ -450,7 +450,7 @@ func SearchUsers(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)
- users, maxResults, err := user_model.SearchUsers(&user_model.SearchUserOptions{
+ users, maxResults, err := user_model.SearchUsers(ctx, &user_model.SearchUserOptions{
Actor: ctx.Doer,
Type: user_model.UserTypeIndividual,
LoginName: ctx.FormTrim("login_name"),