Project authorization EnabledModule N+1 queries
There's a problem with project authorization that causes N+1 queries (one per project in @projects).
In ApplicationController#authorize redmine checks authorization on @project or @projects. This triggers the code in Project#allowed_permissions which calls
The problem here is that pluck circumvents preloading, so no matter wether we do
@projects = Project.includes(:enabled_modules).where(conditions) in a controller, it will still trigger one extra query per project.
Given that the EnableModule model is tiny, this could be prevented by using