diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-08-08 03:26:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-07 19:26:40 +0000 |
commit | f5dbac9d36f1678b928bee04e85fbd045c725698 (patch) | |
tree | d8cd9132eca624e6e9d6bbfa06caa673f879f374 /models | |
parent | ab0eb1c47b10a1a65f9db0b609fb5339613d1708 (diff) | |
download | gitea-f5dbac9d36f1678b928bee04e85fbd045c725698.tar.gz gitea-f5dbac9d36f1678b928bee04e85fbd045c725698.zip |
Use more `IssueList` instead of `[]*Issue` (#26369)
Diffstat (limited to 'models')
-rw-r--r-- | models/issues/issue.go | 6 | ||||
-rw-r--r-- | models/issues/issue_project.go | 4 | ||||
-rw-r--r-- | models/issues/issue_search.go | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/models/issues/issue.go b/models/issues/issue.go index 38726de85a..f000f4c660 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -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"). @@ -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 } diff --git a/models/issues/issue_project.go b/models/issues/issue_project.go index 782638d997..ed249527bf 100644 --- a/models/issues/issue_project.go +++ b/models/issues/issue_project.go @@ -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{ @@ -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 } diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index f9c1dbb384..281339044b 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -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) |