aboutsummaryrefslogtreecommitdiffstats
path: root/services/convert
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-14 10:37:24 +0200
committerGitHub <noreply@github.com>2023-10-14 08:37:24 +0000
commit76a85a4ce90fead1eb2b743a42b41617b4592889 (patch)
treeef172bbbc48c24e0d95cd5c689426bad16205a69 /services/convert
parentae419fa49403537725c806a5f3f1e5b274f52eb7 (diff)
downloadgitea-76a85a4ce90fead1eb2b743a42b41617b4592889.tar.gz
gitea-76a85a4ce90fead1eb2b743a42b41617b4592889.zip
Final round of `db.DefaultContext` refactor (#27587)
Last part of #27065
Diffstat (limited to 'services/convert')
-rw-r--r--services/convert/issue.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/services/convert/issue.go b/services/convert/issue.go
index 708eac36cf..39d785e108 100644
--- a/services/convert/issue.go
+++ b/services/convert/issue.go
@@ -9,7 +9,6 @@ import (
"net/url"
"strings"
- "code.gitea.io/gitea/models/db"
issues_model "code.gitea.io/gitea/models/issues"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
@@ -150,7 +149,7 @@ func ToTrackedTime(ctx context.Context, t *issues_model.TrackedTime) (apiT *api.
}
// ToStopWatches convert Stopwatch list to api.StopWatches
-func ToStopWatches(sws []*issues_model.Stopwatch) (api.StopWatches, error) {
+func ToStopWatches(ctx context.Context, sws []*issues_model.Stopwatch) (api.StopWatches, error) {
result := api.StopWatches(make([]api.StopWatch, 0, len(sws)))
issueCache := make(map[int64]*issues_model.Issue)
@@ -165,14 +164,14 @@ func ToStopWatches(sws []*issues_model.Stopwatch) (api.StopWatches, error) {
for _, sw := range sws {
issue, ok = issueCache[sw.IssueID]
if !ok {
- issue, err = issues_model.GetIssueByID(db.DefaultContext, sw.IssueID)
+ issue, err = issues_model.GetIssueByID(ctx, sw.IssueID)
if err != nil {
return nil, err
}
}
repo, ok = repoCache[issue.RepoID]
if !ok {
- repo, err = repo_model.GetRepositoryByID(db.DefaultContext, issue.RepoID)
+ repo, err = repo_model.GetRepositoryByID(ctx, issue.RepoID)
if err != nil {
return nil, err
}