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
Fix some more rendering calls
Klaus Zanders9ab9603fe226
diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rbindex 5305f4c12df..9d4eb154f68 100644--- a/app/controllers/shares_controller.rb+++ b/app/controllers/shares_controller.rb@@ -54,6 +54,8 @@ class SharesController < ApplicationControlleroverall_result = []@errors = ActiveModel::Errors.new(self)+ had_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])if user.present? && user.locked?@@ -64,13 +66,13 @@ class SharesController < ApplicationControllerendend- @new_shares = overall_result.map(&:result).reverse+ new_shares = overall_result.map(&:result).reverseif overall_result.present?- # In case the number of newly added shares is equal to the whole number of shares,- # we have to render the whole modal again to get rid of the blankslate- if current_visible_member_count > 1 && @new_shares.size < current_visible_member_count- respond_with_prepend_shares+ # 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+ respond_with_prepend_shares(new_shares)elserespond_with_replace_modalend@@ -96,7 +98,8 @@ class SharesController < ApplicationControllerdef destroydestroy_share(@share)- if current_visible_member_count.zero?+ # When we removed the last share we have to replace the modal to show the blankstate+ if sharing_strategy.shares(reload: true).empty?respond_with_replace_modalelserespond_with_remove_share@@ -115,16 +118,16 @@ class SharesController < ApplicationControllerdef bulk_update@selected_shares.each { |share| create_or_update_share(share.principal.id, params[:role_ids]) }- respond_with_bulk_updated_permission_buttons+ respond_with_bulk_updated_permission_buttons(@selected_shares)enddef bulk_destroy@selected_shares.each { |share| destroy_share(share) }- if current_visible_member_count.zero?+ if sharing_strategy.shares(reload: true).empty?respond_with_replace_modalelse- respond_with_bulk_removed_shares+ respond_with_bulk_removed_shares(@selected_shares)endend@@ -177,7 +180,7 @@ class SharesController < ApplicationControllerrespond_with_turbo_streamsend- def respond_with_prepend_shares+ def respond_with_prepend_shares(new_shares)replace_via_turbo_stream(component: Shares::InviteUserFormComponent.new(strategy: sharing_strategy,@@ -188,11 +191,11 @@ class SharesController < ApplicationControllerupdate_via_turbo_stream(component: Shares::CounterComponent.new(strategy: sharing_strategy,- count: current_visible_member_count+ count: sharing_strategy.shares(reload: true).count))- @new_shares.each do |share|+ new_shares.each do |share|prepend_via_turbo_stream(component: Shares::ShareRowComponent.new(share:,@@ -241,7 +244,7 @@ class SharesController < ApplicationControllerupdate_via_turbo_stream(component: Shares::CounterComponent.new(strategy: sharing_strategy,- count: current_visible_member_count+ count: sharing_strategy.shares(reload: true).count))@@ -260,8 +263,8 @@ class SharesController < ApplicationControllerrespond_with_turbo_streamsend- def respond_with_bulk_updated_permission_buttons- @selected_shares.each do |share|+ def respond_with_bulk_updated_permission_buttons(selected_shares)+ selected_shares.each do |share|replace_via_turbo_stream(component: Shares::PermissionButtonComponent.new(share:,@@ -274,8 +277,8 @@ class SharesController < ApplicationControllerrespond_with_turbo_streamsend- def respond_with_bulk_removed_shares- @selected_shares.each do |share|+ def respond_with_bulk_removed_shares(selected_shares)+ selected_shares.each do |share|remove_via_turbo_stream(component: Shares::ShareRowComponent.new(share:,@@ -286,7 +289,7 @@ class SharesController < ApplicationControllerupdate_via_turbo_stream(component: Shares::CounterComponent.new(- count: current_visible_member_count,+ count: sharing_strategy.shares(reload: true).count,strategy: sharing_strategy))@@ -317,10 +320,6 @@ class SharesController < ApplicationController@share = @entity.members.find(params[:id])end- def current_visible_member_count- @current_visible_member_count ||= sharing_strategy.shares.size- end-def load_selected_shares@selected_shares = Member.includes(:principal).of_entity(@entity)