summaryrefslogtreecommitdiffstats
path: root/models/issues/comment_list.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-11-19 09:12:33 +0100
committerGitHub <noreply@github.com>2022-11-19 16:12:33 +0800
commit044c754ea53f5b81f451451df53aea366f6f700a (patch)
tree45688c28a84f87f71ec3f99eb0e8456eb7d19c42 /models/issues/comment_list.go
parentfefdb7ffd11bbfbff66dae8e88681ec840dedfde (diff)
downloadgitea-044c754ea53f5b81f451451df53aea366f6f700a.tar.gz
gitea-044c754ea53f5b81f451451df53aea366f6f700a.zip
Add `context.Context` to more methods (#21546)
This PR adds a context parameter to a bunch of methods. Some helper `xxxCtx()` methods got replaced with the normal name now. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/issues/comment_list.go')
-rw-r--r--models/issues/comment_list.go30
1 files changed, 9 insertions, 21 deletions
diff --git a/models/issues/comment_list.go b/models/issues/comment_list.go
index 70105d7ff0..e42b8605f9 100644
--- a/models/issues/comment_list.go
+++ b/models/issues/comment_list.go
@@ -24,7 +24,8 @@ func (comments CommentList) getPosterIDs() []int64 {
return posterIDs.Values()
}
-func (comments CommentList) loadPosters(ctx context.Context) error {
+// LoadPosters loads posters
+func (comments CommentList) LoadPosters(ctx context.Context) error {
if len(comments) == 0 {
return nil
}
@@ -277,7 +278,8 @@ func (comments CommentList) Issues() IssueList {
return issueList
}
-func (comments CommentList) loadIssues(ctx context.Context) error {
+// LoadIssues loads issues of comments
+func (comments CommentList) LoadIssues(ctx context.Context) error {
if len(comments) == 0 {
return nil
}
@@ -382,7 +384,8 @@ func (comments CommentList) loadDependentIssues(ctx context.Context) error {
return nil
}
-func (comments CommentList) loadAttachments(ctx context.Context) (err error) {
+// LoadAttachments loads attachments
+func (comments CommentList) LoadAttachments(ctx context.Context) (err error) {
if len(comments) == 0 {
return nil
}
@@ -476,7 +479,7 @@ func (comments CommentList) loadReviews(ctx context.Context) error { //nolint
// loadAttributes loads all attributes
func (comments CommentList) loadAttributes(ctx context.Context) (err error) {
- if err = comments.loadPosters(ctx); err != nil {
+ if err = comments.LoadPosters(ctx); err != nil {
return
}
@@ -496,7 +499,7 @@ func (comments CommentList) loadAttributes(ctx context.Context) (err error) {
return
}
- if err = comments.loadAttachments(ctx); err != nil {
+ if err = comments.LoadAttachments(ctx); err != nil {
return
}
@@ -504,7 +507,7 @@ func (comments CommentList) loadAttributes(ctx context.Context) (err error) {
return
}
- if err = comments.loadIssues(ctx); err != nil {
+ if err = comments.LoadIssues(ctx); err != nil {
return
}
@@ -520,18 +523,3 @@ func (comments CommentList) loadAttributes(ctx context.Context) (err error) {
func (comments CommentList) LoadAttributes() error {
return comments.loadAttributes(db.DefaultContext)
}
-
-// LoadAttachments loads attachments
-func (comments CommentList) LoadAttachments() error {
- return comments.loadAttachments(db.DefaultContext)
-}
-
-// LoadPosters loads posters
-func (comments CommentList) LoadPosters() error {
- return comments.loadPosters(db.DefaultContext)
-}
-
-// LoadIssues loads issues of comments
-func (comments CommentList) LoadIssues() error {
- return comments.loadIssues(db.DefaultContext)
-}