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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#36559] use User.current instead of passing current_user around
Tobias Dillmann2b3b369787c5
diff --git a/app/models/query.rb b/app/models/query.rbindex 0d7ac379e64..b188c2dd8cb 100644--- a/app/models/query.rb+++ b/app/models/query.rb@@ -69,9 +69,9 @@ class Query < ApplicationRecordscope(:global, -> { where(project_id: nil) })- def self.new_default(attributes = nil, current_user = nil)+ def self.new_default(attributes = nil)new(attributes).tap do |query|- query.current_user = current_user+ query.current_user = User.currentquery.add_default_filterquery.set_default_sortquery.show_hierarchies = truediff --git a/lib/api/v3/queries/create_form_api.rb b/lib/api/v3/queries/create_form_api.rbindex 050632724ff..614e0489880 100644--- a/lib/api/v3/queries/create_form_api.rb+++ b/lib/api/v3/queries/create_form_api.rb@@ -38,7 +38,7 @@ module APIhelpers ::API::V3::Queries::QueryHelperpost do- create_or_update_query_form Query.new_default({}, current_user), ::Queries::CreateContract, CreateFormRepresenter+ create_or_update_query_form Query.new_default, ::Queries::CreateContract, CreateFormRepresenterendendenddiff --git a/lib/api/v3/queries/update_form_api.rb b/lib/api/v3/queries/update_form_api.rbindex ac3c5d0c3a6..af04dd5af45 100644--- a/lib/api/v3/queries/update_form_api.rb+++ b/lib/api/v3/queries/update_form_api.rb@@ -36,8 +36,6 @@ module APIhelpers ::API::V3::Queries::QueryHelperpost do- @query.current_user = current_user-# We try to ignore invalid aspects of the query as the user# might not even be able to fix them (public query)# and because they might only be invalid in his context