-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Perform Newest sort type correctly when sorting issues #30644
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
Changes from 2 commits
a5d39ef
4136728
d7b008a
340f488
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,8 +68,6 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp | |
searchOpt.Paginator = opts.Paginator | ||
|
||
switch opts.SortType { | ||
case "": | ||
searchOpt.SortBy = SortByCreatedDesc | ||
case "oldest": | ||
searchOpt.SortBy = SortByCreatedAsc | ||
case "recentupdate": | ||
|
@@ -87,8 +85,10 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp | |
case "priority", "priorityrepo", "project-column-sorting": | ||
// Unsupported sort type for search | ||
searchOpt.SortBy = SortByUpdatedDesc | ||
case "latest": | ||
fallthrough | ||
default: | ||
searchOpt.SortBy = SortByUpdatedDesc | ||
searchOpt.SortBy = SortByCreatedDesc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it alright to change the default block here? My reasoning for changing this was because only invalid sort types would resort in executing the default block (as expected) and users/web handlers should be passing correct sort type anyways. Alternatively I could just add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure whether it is right to change the "default" behavior. I think the old behavior should be kept as-is if it is not clear. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha, I made the necessary changes and decided to change the second-to-last case statement to just use a |
||
} | ||
|
||
return searchOpt | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misunderstood, plz ignore my comment above.
Your fix is right, it think it is better to fix it here.
Unsupported sort type should be same to default?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries!
Another review was made and it was determined that we shouldn't change the default block. However, I did replace the only line of this case block with a
fallthrough
since it's the same as thedefault
block.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest version LGTM.