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
Do not add owner when we show groups
Klaus Zandersae1654d5eb7b
diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rbindex 9d4eb154f68..dbc6a505fae 100644--- a/app/controllers/shares_controller.rb+++ b/app/controllers/shares_controller.rb@@ -54,7 +54,7 @@ class SharesController < ApplicationControlleroverall_result = []@errors = ActiveModel::Errors.new(self)- had_shares_before_adding = sharing_strategy.shares.present?+ visible_shares_before_adding = sharing_strategy.shares.present?find_or_create_users(send_notification: false) do |member_params|user = User.find_by(id: member_params[:user_id])@@ -71,7 +71,7 @@ class SharesController < ApplicationControllerif overall_result.present?# In case we did not have shares before we have to replace the modal to get rid of the blankstate,# otherwise we can prepend the new shares- if had_shares_before_adding+ if visible_shares_before_addingrespond_with_prepend_shares(new_shares)elserespond_with_replace_modaldiff --git a/app/models/sharing_strategies/project_query_strategy.rb b/app/models/sharing_strategies/project_query_strategy.rbindex 0280d917a24..19d7ec62348 100644--- a/app/models/sharing_strategies/project_query_strategy.rb+++ b/app/models/sharing_strategies/project_query_strategy.rb@@ -79,6 +79,7 @@ module SharingStrategiesdef shares(reload: false)results = super+ return results if filter_for_groups?if (!filtered_by_role? && results.present?) || owner_matches_role_filter?(results + [virtual_owner_share]).sort_by { |share| share.principal.name }@@ -118,5 +119,12 @@ module SharingStrategiesrole_filter.values.include?(owner_role.id.to_s) # rubocop:disable Performance/InefficientHashSearchend++ def filter_for_groups?+ principal_filter = query.filters.find { |filter| filter.is_a?(Queries::Members::Filters::PrincipalTypeFilter) }+ return false if principal_filter.nil?++ principal_filter.values.count == 1 && principal_filter.values.include?("Group") # rubocop:disable Performance/InefficientHashSearch+ endendend