1
0
Fork 0
forked from forgejo/forgejo

Next round of db.DefaultContext refactor (#27089)

Part of #27065
This commit is contained in:
JakobDev 2023-09-16 16:39:12 +02:00 committed by GitHub
parent a1b2a11812
commit f91dbbba98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 434 additions and 464 deletions

View file

@ -53,7 +53,7 @@ func ListTopics(ctx *context.APIContext) {
RepoID: ctx.Repo.Repository.ID,
}
topics, total, err := repo_model.FindTopics(opts)
topics, total, err := repo_model.FindTopics(ctx, opts)
if err != nil {
ctx.InternalServerError(err)
return
@ -120,7 +120,7 @@ func UpdateTopics(ctx *context.APIContext) {
return
}
err := repo_model.SaveTopics(ctx.Repo.Repository.ID, validTopics...)
err := repo_model.SaveTopics(ctx, ctx.Repo.Repository.ID, validTopics...)
if err != nil {
log.Error("SaveTopics failed: %v", err)
ctx.InternalServerError(err)
@ -172,7 +172,7 @@ func AddTopic(ctx *context.APIContext) {
}
// Prevent adding more topics than allowed to repo
count, err := repo_model.CountTopics(&repo_model.FindTopicOptions{
count, err := repo_model.CountTopics(ctx, &repo_model.FindTopicOptions{
RepoID: ctx.Repo.Repository.ID,
})
if err != nil {
@ -187,7 +187,7 @@ func AddTopic(ctx *context.APIContext) {
return
}
_, err = repo_model.AddTopic(ctx.Repo.Repository.ID, topicName)
_, err = repo_model.AddTopic(ctx, ctx.Repo.Repository.ID, topicName)
if err != nil {
log.Error("AddTopic failed: %v", err)
ctx.InternalServerError(err)
@ -238,7 +238,7 @@ func DeleteTopic(ctx *context.APIContext) {
return
}
topic, err := repo_model.DeleteTopic(ctx.Repo.Repository.ID, topicName)
topic, err := repo_model.DeleteTopic(ctx, ctx.Repo.Repository.ID, topicName)
if err != nil {
log.Error("DeleteTopic failed: %v", err)
ctx.InternalServerError(err)
@ -287,7 +287,7 @@ func TopicSearch(ctx *context.APIContext) {
ListOptions: utils.GetListOptions(ctx),
}
topics, total, err := repo_model.FindTopics(opts)
topics, total, err := repo_model.FindTopics(ctx, opts)
if err != nil {
ctx.InternalServerError(err)
return