Do not set unsupported sort order from user preferences
What does this MR do and why?
When displaying collections (e.g., in issues list or group dashboard), some sort options may not be supported depending on the context and we should conditionally restore and set the sort order from saved user preferences.
We currently store the last sort options used for various domain objects (issues, projects, epics, etc.) in user_preferences
table. However, the same sort option may not be supported across all views that display an issues list. One example is sorting issues by weight. Because Weight is a GitLab Premium feature, we need to check for its availability for a namespace and we've been only supporting the sort option in group and project issues list.
Screenshots or screen recordings
https://drive.google.com/file/d/1ExQ5MrdoU5cJ3NsV8SvVARtorvo9Wbs5/view?usp=sharing
How to set up and validate locally
- Login and go to the dashboard issues. Make sure you have couple issues with
weight
. - Go to any group with multiple issues.
- Sort these issues by
weight
. - Go back to the dashboard issues and make sure they are not sorted by weight.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #355148 (closed)