forked from forgejo/forgejo
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>
This commit is contained in:
parent
fefdb7ffd1
commit
044c754ea5
148 changed files with 1411 additions and 1564 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue