Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion models/project/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ func (p *Project) getDefaultColumn(ctx context.Context) (*Column, error) {
return nil, ErrProjectColumnNotExist{ColumnID: 0}
}

// MustDefaultColumn returns the default column for a project, get the first one if exist one and creating one if it does not exist
// MustDefaultColumn returns the default column for a project.
// If one exists, it is returned
// If none exists, the first column will be elevated to the default column of this project
func (p *Project) MustDefaultColumn(ctx context.Context) (*Column, error) {
c, err := p.getDefaultColumn(ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Desc(id) in the called method seems incorrect.
Shouldn't it be Asc(sorting, id) instead?
(even if it might be potentially minimally breaking if someone misconfigured their projects)

Copy link
Member Author

@lunny lunny Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's already OrderBy("sorting, id")?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@wxiaoguang wxiaoguang Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it should change the existing logic in getDefaultColumn

The old logic means this: use the latest default one. It doesn't care about "sorting" or not. There should be only one "default" column, the "order by" is just a fallback.

if err != nil && !IsErrProjectColumnNotExist(err) {
Expand Down
2 changes: 1 addition & 1 deletion services/projects/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func MoveIssuesOnProjectColumn(ctx context.Context, doer *user_model.User, colum
})
}

// LoadIssuesFromProject load issues assigned to the project
// LoadIssuesFromProject load issues assigned to each project column inside the given project
func LoadIssuesFromProject(ctx context.Context, project *project_model.Project, opts *issues_model.IssuesOptions) (map[int64]issues_model.IssueList, error) {
issueList, err := issues_model.Issues(ctx, opts.Copy(func(o *issues_model.IssuesOptions) {
o.ProjectID = project.ID
Expand Down
Loading