Skip to content

Commit f5dbac9

Browse files
authored
Use more IssueList instead of []*Issue (#26369)
1 parent ab0eb1c commit f5dbac9

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

models/issues/issue.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,8 @@ func (issue *Issue) MovePin(ctx context.Context, newPosition int) error {
854854
}
855855

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

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

871-
err = IssueList(issues).LoadAttributes(ctx)
871+
err = issues.LoadAttributes(ctx)
872872
if err != nil {
873873
return nil, err
874874
}

models/issues/issue_project.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (issue *Issue) projectBoardID(ctx context.Context) int64 {
5353

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

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

82-
if err := IssueList(issueList).LoadComments(ctx); err != nil {
82+
if err := issueList.LoadComments(ctx); err != nil {
8383
return nil, err
8484
}
8585

models/issues/issue_search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func GetRepoIDsForIssuesOptions(opts *IssuesOptions, user *user_model.User) ([]i
441441
}
442442

443443
// Issues returns a list of issues by given conditions.
444-
func Issues(ctx context.Context, opts *IssuesOptions) ([]*Issue, error) {
444+
func Issues(ctx context.Context, opts *IssuesOptions) (IssueList, error) {
445445
sess := db.GetEngine(ctx).
446446
Join("INNER", "repository", "`issue`.repo_id = `repository`.id")
447447
applyLimit(sess, opts)

routers/web/user/notification.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ func NotificationSubscriptions(ctx *context.Context) {
296296
}
297297
ctx.Data["CommitStatus"] = commitStatus
298298

299-
issueList := issues_model.IssueList(issues)
300-
approvalCounts, err := issueList.GetApprovalCounts(ctx)
299+
approvalCounts, err := issues.GetApprovalCounts(ctx)
301300
if err != nil {
302301
ctx.ServerError("ApprovalCounts", err)
303302
return

0 commit comments

Comments
 (0)