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
Update trial banner handling for sharing modals
Mir Bhatia9f1b2ebb3265
diff --git a/app/components/shares/modal_body_component.html.erb b/app/components/shares/modal_body_component.html.erbindex d2da46e0b2a..7612091818c 100644--- a/app/components/shares/modal_body_component.html.erb+++ b/app/components/shares/modal_body_component.html.erb@@ -7,9 +7,8 @@endend- render(Shares::ProjectQueries::UpsellComponent.new(modal_content:))-- render(strategy.manage_shares_component(modal_content:, errors:)) if EnterpriseToken.allows_to?(:project_list_sharing)+ render(strategy.upsell_banner(modal_content:))+ render(strategy.manage_shares_component(modal_content:, errors:)) if strategy.allow_feature?endend%>diff --git a/app/components/shares/work_packages/modal_upsell_component.html.erb b/app/components/shares/work_packages/modal_upsell_component.html.erbindex b283aba4e06..f10285902d1 100644--- a/app/components/shares/work_packages/modal_upsell_component.html.erb+++ b/app/components/shares/work_packages/modal_upsell_component.html.erb@@ -1,5 +1,7 @@<%=component_wrapper(tag: "turbo-frame") do- render(EnterpriseEdition::BannerComponent.new(:work_package_sharing))+ modal_content.with_row do+ render(EnterpriseEdition::BannerComponent.new(:work_package_sharing))+ endend%>diff --git a/app/components/shares/work_packages/modal_upsell_component.rb b/app/components/shares/work_packages/modal_upsell_component.rbindex 3b9efbb5a81..a26e98f422c 100644--- a/app/components/shares/work_packages/modal_upsell_component.rb+++ b/app/components/shares/work_packages/modal_upsell_component.rb@@ -33,6 +33,14 @@ module Sharesinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpers+ def initialize(modal_content:)+ super++ @modal_content = modal_content+ end++ attr_reader :modal_content+def self.wrapper_key"share_modal_body"enddiff --git a/app/models/sharing_strategies/project_query_strategy.rb b/app/models/sharing_strategies/project_query_strategy.rbindex da6428bca5b..cd30bb88804 100644--- a/app/models/sharing_strategies/project_query_strategy.rb+++ b/app/models/sharing_strategies/project_query_strategy.rb@@ -109,6 +109,15 @@ module SharingStrategiesI18n.t(:label_share_project_list)end+ def upsell_banner(modal_content:)+ Shares::ProjectQueries::UpsellComponent.new(modal_content:)+ end++ def allow_feature?+ EnterpriseToken.allows_to?(:project_list_sharing) ||+ EnterpriseToken.trialling?(:project_list_sharing)+ end+privatedef virtual_owner_sharediff --git a/app/models/sharing_strategies/work_package_strategy.rb b/app/models/sharing_strategies/work_package_strategy.rbindex d51c3be999f..e398663d0e9 100644--- a/app/models/sharing_strategies/work_package_strategy.rb+++ b/app/models/sharing_strategies/work_package_strategy.rb@@ -99,18 +99,19 @@ module SharingStrategiesShares::WorkPackages::DeleteContractend- def modal_body_component(errors)- if EnterpriseToken.allows_to?(:work_package_sharing)- super- else- Shares::WorkPackages::ModalUpsellComponent.new- end- end-def titleI18n.t(:label_share_work_package)end+ def upsell_banner(modal_content:)+ Shares::WorkPackages::ModalUpsellComponent.new(modal_content:)+ end++ def allow_feature?+ EnterpriseToken.allows_to?(:work_package_sharing) ||+ EnterpriseToken.trialling?(:work_package_sharing)+ end+privatedef project_member?(share)