Actions
Defect #41791
openProjects endpoint returns list of all projects
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Affected version:
Description
Redmine info:
Environment: Redmine version 6.0.1.stable Ruby version 3.3.6-p108 (2024-11-05) [x86_64-linux] Rails version 7.2.2 Environment production Database adapter PostgreSQL Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp Redmine settings: Redmine theme Alternate SCM: Subversion 1.14.2 Mercurial 6.3.2 Bazaar 3.3.2 Git 2.39.5 Filesystem
As of version 6.0, the REST API /projects endpoint has started returning a list of all projects, instead of using the default limit of 25. Also, `limits` and `offset` do not seem to work on this endpoint.
Related issues
Updated by Holger Just 1 day ago
- Related to Feature #23954: Shows the date of the last activity on Projects administration added
Updated by Holger Just 1 day ago
- Status changed from New to Confirmed
This was broken in r22811 for #23954.
Previously, the limit
and offset
was applied in the controller to the scope. With the change, this was delegated to ProjectController#project_scope
, which just forwards this to ProjectQuery#results_scope
. However, the ProjectQuery models does not set this.
A quick patch could be this, in addition to some tests:
index 6defbcc834..8386ca7d4b 100644
--- a/app/models/project_query.rb
+++ b/app/models/project_query.rb
@@ -158,6 +158,9 @@ def results_scope(options={})
order(order_option).
joins(joins_for_order_statement(order_option.join(',')))
+ scope = scope.limit(options[:limit]) if options.key?(:limit)
+ scope = scope.offset(options[:offset]) if options.key?(:offset)
+
if has_custom_field_column?
scope = scope.preload(:custom_values)
end
Note that this bug also affects the list view of the projects list as well as the projects atom feed.
Updated by Marius BĂLTEANU 1 day ago
- Assignee set to Marius BĂLTEANU
- Target version set to 6.0.2
Updated by Łukasz Szczepański about 7 hours ago
I can confirm that this change resolves the issue
Actions