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

load storage/activity data only for admins

ulferts8ce7e23ebeea
diff --git a/app/components/projects/table_component.rb b/app/components/projects/table_component.rb
index 19525e2ffc9..7958c81df2a 100644
--- a/app/components/projects/table_component.rb
+++ b/app/components/projects/table_component.rb
@@ -151,10 +151,20 @@ module Projects
end
def projects(query)
- query
- .results
- .with_required_storage
- .with_latest_activity
+ scope = query.results
+
+ # The two columns associated with the
+ # * disk storage
+ # * latest activity
+ # information are only available to admins.
+ # For non admins, the performance penalty of fetching the information therefore needs never be paid.
+ if User.current.admin?
+ scope = scope
+ .with_required_storage
+ .with_latest_activity
+ end
+
+ scope
.includes(:custom_values, :enabled_modules)
.paginate(page: helpers.page_param(params), per_page: helpers.per_page_param(params))
end