summaryrefslogtreecommitdiffstats
path: root/services/issue
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-12-03 10:48:26 +0800
committerGitHub <noreply@github.com>2022-12-03 10:48:26 +0800
commit0a7d3ff786508284224ada17956a65bb759d9265 (patch)
tree4860fca95c1432ab59c6723ee2b053b1c7d6779d /services/issue
parent8698458f48eafeab21014db544aa7160368856e1 (diff)
downloadgitea-0a7d3ff786508284224ada17956a65bb759d9265.tar.gz
gitea-0a7d3ff786508284224ada17956a65bb759d9265.zip
refactor some functions to support ctx as first parameter (#21878)
Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'services/issue')
-rw-r--r--services/issue/assignee.go2
-rw-r--r--services/issue/assignee_test.go2
-rw-r--r--services/issue/commit.go2
-rw-r--r--services/issue/issue.go2
-rw-r--r--services/issue/issue_test.go2
5 files changed, 5 insertions, 5 deletions
diff --git a/services/issue/assignee.go b/services/issue/assignee.go
index 2e62f7cf1c..e5e1456c3f 100644
--- a/services/issue/assignee.go
+++ b/services/issue/assignee.go
@@ -50,7 +50,7 @@ func ToggleAssignee(issue *issues_model.Issue, doer *user_model.User, assigneeID
return
}
- assignee, err1 := user_model.GetUserByIDCtx(db.DefaultContext, assigneeID)
+ assignee, err1 := user_model.GetUserByID(db.DefaultContext, assigneeID)
if err1 != nil {
err = err1
return
diff --git a/services/issue/assignee_test.go b/services/issue/assignee_test.go
index 946085cb91..114ace078e 100644
--- a/services/issue/assignee_test.go
+++ b/services/issue/assignee_test.go
@@ -22,7 +22,7 @@ func TestDeleteNotPassedAssignee(t *testing.T) {
assert.NoError(t, err)
assert.EqualValues(t, 1, len(issue.Assignees))
- user1, err := user_model.GetUserByID(1) // This user is already assigned (see the definition in fixtures), so running UpdateAssignee should unassign him
+ user1, err := user_model.GetUserByID(db.DefaultContext, 1) // This user is already assigned (see the definition in fixtures), so running UpdateAssignee should unassign him
assert.NoError(t, err)
// Check if he got removed
diff --git a/services/issue/commit.go b/services/issue/commit.go
index f9d59b6bd0..efbcd639a5 100644
--- a/services/issue/commit.go
+++ b/services/issue/commit.go
@@ -119,7 +119,7 @@ func UpdateIssuesCommit(doer *user_model.User, repo *repo_model.Repository, comm
// issue is from another repo
if len(ref.Owner) > 0 && len(ref.Name) > 0 {
- refRepo, err = repo_model.GetRepositoryByOwnerAndName(ref.Owner, ref.Name)
+ refRepo, err = repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, ref.Owner, ref.Name)
if err != nil {
if repo_model.IsErrRepoNotExist(err) {
log.Warn("Repository referenced in commit but does not exist: %v", err)
diff --git a/services/issue/issue.go b/services/issue/issue.go
index 23b48c2861..5073dff819 100644
--- a/services/issue/issue.go
+++ b/services/issue/issue.go
@@ -160,7 +160,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m
// AddAssigneeIfNotAssigned adds an assignee only if he isn't already assigned to the issue.
// Also checks for access of assigned user
func AddAssigneeIfNotAssigned(issue *issues_model.Issue, doer *user_model.User, assigneeID int64) (err error) {
- assignee, err := user_model.GetUserByIDCtx(db.DefaultContext, assigneeID)
+ assignee, err := user_model.GetUserByID(db.DefaultContext, assigneeID)
if err != nil {
return err
}
diff --git a/services/issue/issue_test.go b/services/issue/issue_test.go
index 44168388e6..b67d2e2e79 100644
--- a/services/issue/issue_test.go
+++ b/services/issue/issue_test.go
@@ -66,7 +66,7 @@ func TestIssue_DeleteIssue(t *testing.T) {
}
// check issue dependencies
- user, err := user_model.GetUserByID(1)
+ user, err := user_model.GetUserByID(db.DefaultContext, 1)
assert.NoError(t, err)
issue1, err := issues_model.GetIssueByID(db.DefaultContext, 1)
assert.NoError(t, err)