Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary IssueList attribute loads #2936

Merged
merged 2 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions models/issue_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func populateIssueIndexer() error {
if err != nil {
return err
}
if err = IssueList(issues).LoadComments(); err != nil {
return err
}
for _, issue := range issues {
if err := batch.Add(issue.update()); err != nil {
return err
Expand Down
22 changes: 13 additions & 9 deletions models/issue_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func (issues IssueList) loadComments(e Engine) (err error) {
return nil
}

// loadAttributes loads all attributes, expect for attachments and comments
func (issues IssueList) loadAttributes(e Engine) (err error) {
if _, err = issues.loadRepositories(e); err != nil {
return
Expand All @@ -315,18 +316,21 @@ func (issues IssueList) loadAttributes(e Engine) (err error) {
return
}

if err = issues.loadAttachments(e); err != nil {
return
}

if err = issues.loadComments(e); err != nil {
return
}

return nil
}

// LoadAttributes loads atrributes of the issues
// LoadAttributes loads attributes of the issues, except for attachments and
// comments
func (issues IssueList) LoadAttributes() error {
return issues.loadAttributes(x)
}

// LoadAttachments loads attachments
func (issues IssueList) LoadAttachments() error {
return issues.loadAttachments(x)
}

// LoadComments loads comments
func (issues IssueList) LoadComments() error {
return issues.loadComments(x)
}