aboutsummaryrefslogtreecommitdiffstats
path: root/services/convert
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2023-01-09 11:50:54 +0800
committerGitHub <noreply@github.com>2023-01-09 11:50:54 +0800
commit7adc2de46404e32ed33f999d308ed56232cdfea5 (patch)
tree2404a22b5fa8a941eb5bfd16fd717fab29d899e4 /services/convert
parentb878155b8741c2769b6aa50a80609c36822451c9 (diff)
downloadgitea-7adc2de46404e32ed33f999d308ed56232cdfea5.tar.gz
gitea-7adc2de46404e32ed33f999d308ed56232cdfea5.zip
Use context parameter in models/git (#22367)
After #22362, we can feel free to use transactions without `db.DefaultContext`. And there are still lots of models using `db.DefaultContext`, I think we should refactor them carefully and one by one. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'services/convert')
-rw-r--r--services/convert/convert.go2
-rw-r--r--services/convert/status.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/services/convert/convert.go b/services/convert/convert.go
index a8329f5285..2ce51bf063 100644
--- a/services/convert/convert.go
+++ b/services/convert/convert.go
@@ -87,7 +87,7 @@ func ToBranch(repo *repo_model.Repository, b *git.Branch, c *git.Commit, bp *git
if err != nil {
return nil, err
}
- branch.UserCanPush = bp.CanUserPush(user.ID)
+ branch.UserCanPush = bp.CanUserPush(db.DefaultContext, user.ID)
branch.UserCanMerge = git_model.IsUserMergeWhitelisted(db.DefaultContext, bp, user.ID, permission)
}
diff --git a/services/convert/status.go b/services/convert/status.go
index 5fcf04074f..84ca1665d2 100644
--- a/services/convert/status.go
+++ b/services/convert/status.go
@@ -20,7 +20,7 @@ func ToCommitStatus(ctx context.Context, status *git_model.CommitStatus) *api.Co
TargetURL: status.TargetURL,
Description: status.Description,
ID: status.Index,
- URL: status.APIURL(),
+ URL: status.APIURL(ctx),
Context: status.Context,
}