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
Move loading of shares into the strategy
Klaus Zanders15e3f69af6e5
diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rbindex 5eebc6cef77..0c517b9ec1b 100644--- a/app/controllers/shares_controller.rb+++ b/app/controllers/shares_controller.rb@@ -326,22 +326,7 @@ class SharesController < ApplicationControllerenddef load_query- return @query if defined?(@query)-- @query = ParamsToQueryService- .new(Member, current_user, query_class: Queries::Members::NonInheritedMemberQuery)- .call(params)-- # Set default filter on the entity- @query.where("entity_id", "=", @entity.id)- @query.where("entity_type", "=", @entity.class.name)- if @project- @query.where("project_id", "=", @project.id)- end-- @query.order(name: :asc) unless params[:sortBy]-- @query+ @query = sharing_strategy.shares_query(params)enddef load_sharesdiff --git a/app/models/sharing_strategies/base_strategy.rb b/app/models/sharing_strategies/base_strategy.rbindex e28dbf2e55a..ce2b186799b 100644--- a/app/models/sharing_strategies/base_strategy.rb+++ b/app/models/sharing_strategies/base_strategy.rb@@ -79,5 +79,24 @@ module SharingStrategiesdef empty_state_componentnilend++ def shares_query(params) # rubocop:disable Metrics/AbcSize+ return @query if defined?(@query)++ @query = ParamsToQueryService+ .new(Member, user, query_class: Queries::Members::NonInheritedMemberQuery)+ .call(params)++ # Set default filter on the entity+ @query.where("entity_id", "=", entity.id)+ @query.where("entity_type", "=", entity.class.name)+ if entity.respond_to?(:project)+ @query.where("project_id", "=", entity.project.id)+ end++ @query.order(name: :asc) unless params[:sortBy]++ @query+ endendend