Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

use partition instead of sort_by.with_index to reorder favored to the top

Ivan Kuchinad3bd9925ed3
diff --git a/app/menus/projects/menu.rb b/app/menus/projects/menu.rb
index 96fb25144cb..fd31bab939c 100644
--- a/app/menus/projects/menu.rb
+++ b/app/menus/projects/menu.rb
@@ -121,7 +121,7 @@ module Projects
def persisted_filters
@persisted_filters = ::ProjectQuery.visible(current_user).order(:name)
- .sort_by.with_index { |query, i| [query.id.in?(favored_ids) ? 0 : 1, i] }
+ .partition { |query| query.id.in?(favored_ids) }.flatten
end
def favored_ids