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

Use more IssueList instead of []*Issue #26369

Merged
merged 4 commits into from
Aug 7, 2023
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
6 changes: 3 additions & 3 deletions models/issues/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ func (issue *Issue) MovePin(ctx context.Context, newPosition int) error {
}

// GetPinnedIssues returns the pinned Issues for the given Repo and type
func GetPinnedIssues(ctx context.Context, repoID int64, isPull bool) ([]*Issue, error) {
issues := make([]*Issue, 0)
func GetPinnedIssues(ctx context.Context, repoID int64, isPull bool) (IssueList, error) {
issues := make(IssueList, 0)

err := db.GetEngine(ctx).
Table("issue").
Expand All @@ -868,7 +868,7 @@ func GetPinnedIssues(ctx context.Context, repoID int64, isPull bool) ([]*Issue,
return nil, err
}

err = IssueList(issues).LoadAttributes(ctx)
err = issues.LoadAttributes(ctx)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions models/issues/issue_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (issue *Issue) projectBoardID(ctx context.Context) int64 {

// LoadIssuesFromBoard load issues assigned to this board
func LoadIssuesFromBoard(ctx context.Context, b *project_model.Board) (IssueList, error) {
issueList := make([]*Issue, 0, 10)
issueList := make(IssueList, 0, 10)

if b.ID != 0 {
issues, err := Issues(ctx, &IssuesOptions{
Expand All @@ -79,7 +79,7 @@ func LoadIssuesFromBoard(ctx context.Context, b *project_model.Board) (IssueList
issueList = append(issueList, issues...)
}

if err := IssueList(issueList).LoadComments(ctx); err != nil {
if err := issueList.LoadComments(ctx); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion models/issues/issue_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func GetRepoIDsForIssuesOptions(opts *IssuesOptions, user *user_model.User) ([]i
}

// Issues returns a list of issues by given conditions.
func Issues(ctx context.Context, opts *IssuesOptions) ([]*Issue, error) {
func Issues(ctx context.Context, opts *IssuesOptions) (IssueList, error) {
sess := db.GetEngine(ctx).
Join("INNER", "repository", "`issue`.repo_id = `repository`.id")
applyLimit(sess, opts)
Expand Down
3 changes: 1 addition & 2 deletions routers/web/user/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ func NotificationSubscriptions(ctx *context.Context) {
}
ctx.Data["CommitStatus"] = commitStatus

issueList := issues_model.IssueList(issues)
approvalCounts, err := issueList.GetApprovalCounts(ctx)
approvalCounts, err := issues.GetApprovalCounts(ctx)
if err != nil {
ctx.ServerError("ApprovalCounts", err)
return
Expand Down