-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
add sorting to database query of repo_units #2603
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
Conversation
Signed-off-by: David Schneiderbauer <[email protected]>
401000e
to
e86ed4f
Compare
LGTM |
Can you add integration test for this? |
@lafriks Hopefully 😄 |
Signed-off-by: David Schneiderbauer <[email protected]>
@lafriks Changed repo_unit fixtures. Wrong sorting breaks all integration tests which call /user2/repo1 without adding sorting. |
Codecov Report
@@ Coverage Diff @@
## master #2603 +/- ##
======================================
Coverage 27.3% 27.3%
======================================
Files 86 86
Lines 17139 17139
======================================
Hits 4680 4680
Misses 11781 11781
Partials 678 678
Continue to review full report at Codecov.
|
But |
@lunny but it's not used anywhere. And current code logic depends on unit types to be in type order when checking rights and it fails if it is not so |
Might be that home just need to be changed so that order would not matter and fixtures moved to that PR than this one would not be needed at all |
@lunny @lafriks @Morlinest As long as index has the same sorting as the tab ordering in repo view it is fine to use index to sort types. And since index is the integer value of the UnitType constant it is. |
which issue will this PR fix? |
@lunny Use the |
@daviian Index is not integer value of Edit: Index from range is used as |
@lunny What should be source for |
@Morlinest yes. |
LGTM |
Actually I think fix should go into home handler so that it would not crash even if units come in different order |
@lafriks Yes, it's not conflict with them. |
Yes that's why I ask to hold on with this PR merging so that other can be fixed properly |
@lafriks You mean that the Home handler should be capable of knowing the correct order of unit types (to open the leftmost accessible tab) without doing sorting at db layer? |
Yes. I think it should take unit order from models.AllUnitTypes and use it and then check if each of them is enabled |
We can improve it later. And then we can just remove |
@lafriks could this be merged? |
Close in favour of #2621 |
If sorting is wrong and UnitTypeCode is not the first one, a user can't visit to the
Code
Tab even with required permissions.Furthermore fixes wrong redirect to leftmost accessible tab in repo view.