You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we have a globally db.SearchOrderBy for sorting, in some places we still using xorm.Session.Asc(col_name) and xorm.Session.Desc(col_name) which may make mistakes like #25806 and hard to maintain.
I have made a simple keyword search, and found there are two places is using Asc and Desc directly:
I understand what you mean, reuse db.SearchOrderBy as much as possible to avoid bug, but we can only reuse as much as we can, there are still some complex cases where we can't avoid the need to use xorm.Session.Asc(col_name) and xorm.Session.Desc(col_name) directly. For example models/issues/issue_search.go: func applySorts.
So I think your previous modification #25806 was somewhat inappropriate : you change SortType string to OrderBy db.SearchOrderBy ,I don't think SearchOrderBy can cover all cases, and the role of SearchOrderBy should just be to provide some reusable sorting logic。 I'm going to propose a PR to implement it, and I'll probably make some changes to the commit you made in #25806.
Feature Description
As we have a globally
db.SearchOrderBy
for sorting, in some places we still usingxorm.Session.Asc(col_name)
andxorm.Session.Desc(col_name)
which may make mistakes like #25806 and hard to maintain.I have made a simple keyword search, and found there are two places is using
Asc
andDesc
directly:Screenshots
No response
The text was updated successfully, but these errors were encountered: