Skip to content

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

Extract ManageShares Component and replace it for upselling Project List Share

Klaus Zanders577556e50871
diff --git a/app/components/shares/manage_shares_component.html.erb b/app/components/shares/manage_shares_component.html.erb
new file mode 100644
index 00000000000..9cca5dea7e5
--- /dev/null
+++ b/app/components/shares/manage_shares_component.html.erb
@@ -0,0 +1,109 @@
+<%=
+ if strategy.manageable?
+ modal_content.with_row do
+ render(Shares::InviteUserFormComponent.new(strategy:, errors: errors))
+ end
+ end
+
+ modal_content.with_row(data: { 'test-selector': 'op-share-dialog-active-list',
+ controller: 'shares--bulk-selection',
+ application_target: 'dynamic' }) do
+ render(border_box_container(list_id: insert_target_modifier_id)) do |border_box|
+ border_box.with_header(color: :muted, data: { 'test-selector': 'op-share-dialog-header' }) do
+ grid_layout('op-share-dialog-modal-body--header', tag: :div, align_items: :center) do |header_grid|
+ header_grid.with_area(:counter, tag: :div) do
+ render(Shares::CounterComponent.new(strategy:, count: strategy.shares.size))
+ end
+
+ header_grid.with_area(:actions,
+ tag: :div,
+ data: { 'shares--bulk-selection-target': 'defaultActions' }) do
+ flex_layout do |header_actions|
+ header_actions.with_column(mr: 2) do
+ render(Primer::Alpha::ActionMenu.new(anchor_align: :end,
+ select_variant: :single,
+ size: :small,
+ dynamic_label: true,
+ dynamic_label_prefix: I18n.t('sharing.filter.type'),
+ color: :muted,
+ data: { 'test-selector': 'op-share-dialog-filter-type' })) do |menu|
+ menu.with_show_button(scheme: :invisible, color: :muted, data: { 'test-selector': 'op-share-dialog-filter-type-button' }) do |button|
+ button.with_trailing_action_icon(icon: "triangle-down")
+ I18n.t('sharing.filter.type')
+ end
+ type_filter_options.each do |option|
+ menu.with_item(label: option[:label],
+ href: filter_url(type_option: option),
+ method: :get,
+ tag: :a,
+ active: type_filter_option_active?(option),
+ role: "menuitem")
+ end
+ end
+ end
+
+ header_actions.with_column do
+ render(Primer::Alpha::ActionMenu.new(anchor_align: :end,
+ select_variant: :single,
+ size: :small,
+ dynamic_label: true,
+ dynamic_label_prefix: I18n.t('sharing.filter.role'),
+ color: :muted,
+ data: { 'test-selector': 'op-share-dialog-filter-role' })) do |menu|
+ menu.with_show_button(scheme: :invisible, color: :muted, data: { 'test-selector': 'op-share-dialog-filter-role-button' }) do |button|
+ button.with_trailing_action_icon(icon: "triangle-down")
+ I18n.t('sharing.filter.role')
+ end
+ strategy.available_roles.each do |role_hash|
+ menu.with_item(label: role_hash[:label],
+ href: filter_url(role_option: role_hash),
+ method: :get,
+ tag: :a,
+ active: role_filter_option_active?(role_hash),
+ role: "menuitem")
+ end
+ end
+ end
+ end
+ end
+
+ header_grid.with_area(:actions,
+ tag: :div,
+ hidden: true, # Prevent flicker on initial render
+ data: { 'shares--bulk-selection-target': 'bulkActions' }) do
+ if strategy.manageable?
+ concat(render(Shares::BulkPermissionButtonComponent.new(strategy:)))
+
+ concat(
+ form_with(url: url_for([:bulk, entity, Member]),
+ method: :delete,
+ data: { 'shares--bulk-selection-target': 'bulkForm' }) do
+ render(Primer::Beta::IconButton.new(icon: "trash",
+ type: :submit,
+ scheme: :danger,
+ "aria-label": I18n.t('sharing.remove'),
+ test_selector: 'op-share-dialog--bulk-remove'))
+ end
+ )
+ end
+ end
+ end
+ end
+
+ if strategy.shares.none?
+ border_box.with_row do
+ if strategy.custom_empty_state_component?
+ render(strategy.empty_state_component.new(strategy: strategy))
+ else
+ render(Shares::EmptyStateComponent.new(strategy: strategy))
+ end
+ end
+ else
+ strategy.shares.each do |share|
+ render(Shares::ShareRowComponent.new(share:, strategy:, container: border_box))
+ end
+ end
+ end
+ end
+
+%>
diff --git a/app/components/shares/manage_shares_component.rb b/app/components/shares/manage_shares_component.rb
new file mode 100644
index 00000000000..3392779f2a7
--- /dev/null
+++ b/app/components/shares/manage_shares_component.rb
@@ -0,0 +1,188 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Shares
+ class ManageSharesComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
+ include ApplicationHelper
+ include MemberHelper
+ include OpPrimer::ComponentHelpers
+
+ attr_reader :strategy,
+ :entity,
+ :errors,
+ :modal_content
+
+ def initialize(strategy:, modal_content:, errors: nil)
+ super
+
+ @strategy = strategy
+ @entity = strategy.entity
+ @errors = errors
+ @modal_content = modal_content
+ end
+
+ def self.wrapper_key
+ "share_modal_body"
+ end
+
+ private
+
+ def project_scoped_entity?
+ entity.respond_to?(:project)
+ end
+
+ def insert_target_modified?
+ true
+ end
+
+ def insert_target_modifier_id
+ "op-share-dialog-active-shares"
+ end
+
+ def type_filter_options
+ if project_scoped_entity?
+ [
+ { label: I18n.t("sharing.filter.project_member"),
+ value: { principal_type: "User", project_member: true } },
+ { label: I18n.t("sharing.filter.not_project_member"),
+ value: { principal_type: "User", project_member: false } },
+ { label: I18n.t("sharing.filter.project_group"),
+ value: { principal_type: "Group", project_member: true } },
+ { label: I18n.t("sharing.filter.not_project_group"),
+ value: { principal_type: "Group", project_member: false } }
+ ]
+ else
+ [
+ { label: I18n.t("sharing.filter.user"), value: { principal_type: "User" } },
+ { label: I18n.t("sharing.filter.group"), value: { principal_type: "Group" } }
+ ]
+
+ end
+ end
+
+ def type_filter_option_active?(option) # rubocop:disable Metrics/AbcSize
+ principal_type_filter_value = current_filter_value(params[:filters], "principal_type")
+ project_member_filter_value = current_filter_value(params[:filters], "also_project_member")
+
+ return false if principal_type_filter_value.nil?
+ return false if project_scoped_entity? && project_member_filter_value.nil?
+
+ principal_type_checked =
+ option[:value][:principal_type] == principal_type_filter_value
+ membership_selected = !project_scoped_entity? ||
+ option[:value][:project_member] == ActiveRecord::Type::Boolean.new.cast(project_member_filter_value)
+
+ principal_type_checked && membership_selected
+ end
+
+ def role_filter_option_active?(option)
+ role_filter_value = current_filter_value(params[:filters], "role_id")
+
+ return false if role_filter_value.nil?
+
+ selected_role = strategy.available_roles.find { _1[:value] == option[:value] }
+
+ selected_role[:value] == role_filter_value.to_i
+ end
+
+ def filter_url(type_option: nil, role_option: nil)
+ return url_for([@entity, Member]) if type_option.nil? && role_option.nil?
+
+ args = {}
+ filter = []
+
+ filter += apply_role_filter(role_option)
+ filter += apply_type_filter(type_option)
+
+ args[:filters] = filter.to_json unless filter.empty?
+
+ url_for([@entity, Member, args])
+ end
+
+ def apply_role_filter(option)
+ current_role_filter_value = current_filter_value(params[:filters], "role_id")
+ filter = []
+
+ if option.nil? && current_role_filter_value.present?
+ # When there is already a role filter set and no new value passed, we want to keep that filter
+ filter = role_filter_for({ value: current_role_filter_value })
+ elsif option.present? && !role_filter_option_active?(option)
+ # Only when the passed filter option is not the currently selected one, we apply the filter
+ filter = role_filter_for(option)
+ end
+
+ filter
+ end
+
+ def role_filter_for(option)
+ [
+ { role_id: { operator: "=", values: [option[:value]] } }
+ ]
+ end
+
+ def apply_type_filter(option)
+ current_type_filter_value = current_filter_value(params[:filters], "principal_type")
+ current_member_filter_value = current_filter_value(params[:filters], "also_project_member")
+ filter = []
+
+ if option.nil? && current_type_filter_value.present? && current_member_filter_value.present?
+ # When there is already a type filter set and no new value passed, we want to keep that filter
+ value = { value: { principal_type: current_type_filter_value, project_member: current_member_filter_value } }
+ filter = type_filter_for(value)
+ elsif option.present? && !type_filter_option_active?(option)
+ # Only when the passed filter option is not the currently selected one, we apply the filter
+ filter = type_filter_for(option)
+ end
+
+ filter
+ end
+
+ def type_filter_for(option)
+ filter = [
+ { principal_type: { operator: "=", values: [option[:value][:principal_type]] } }
+ ]
+
+ if project_scoped_entity?
+ if ActiveRecord::Type::Boolean.new.cast(option[:value][:project_member])
+ filter.push({ also_project_member: { operator: "=", values: [OpenProject::Database::DB_VALUE_TRUE] } })
+ else
+ filter.push({ also_project_member: { operator: "=", values: [OpenProject::Database::DB_VALUE_FALSE] } })
+ end
+ end
+
+ filter
+ end
+
+ def current_filter_value(filters, filter_key)
+ return nil if filters.nil?
+
+ given_filters = JSON.parse(filters).find { |key| key.key?(filter_key) }
+ given_filters ? given_filters[filter_key]["values"].first : nil
+ end
+ end
+end
diff --git a/app/components/shares/modal_body_component.html.erb b/app/components/shares/modal_body_component.html.erb
index fbf12195a64..86aa24b5490 100644
--- a/app/components/shares/modal_body_component.html.erb
+++ b/app/components/shares/modal_body_component.html.erb
@@ -1,119 +1,13 @@
<%=
component_wrapper(tag: 'turbo-frame') do
- flex_layout(data: { turbo: true },
- classes: "op-share-dialog-modal-body--row-container") do |modal_content|
+ flex_layout(data: { turbo: true }, classes: "op-share-dialog-modal-body--row-container") do |modal_content|
if strategy.custom_body_components?
strategy.additional_body_components.each do |component|
render(component.new(strategy: strategy, modal_body_container: modal_content))
end
end
- if strategy.manageable?
- modal_content.with_row do
- render(Shares::InviteUserFormComponent.new(strategy:, errors: errors))
- end
- end
-
- modal_content.with_row(data: { 'test-selector': 'op-share-dialog-active-list',
- controller: 'shares--bulk-selection',
- application_target: 'dynamic' }) do
- render(border_box_container(list_id: insert_target_modifier_id)) do |border_box|
- border_box.with_header(color: :muted, data: { 'test-selector': 'op-share-dialog-header' }) do
- grid_layout('op-share-dialog-modal-body--header', tag: :div, align_items: :center) do |header_grid|
- header_grid.with_area(:counter, tag: :div) do
- render(Shares::CounterComponent.new(strategy:, count: strategy.shares.size))
- end
-
- header_grid.with_area(:actions,
- tag: :div,
- data: { 'shares--bulk-selection-target': 'defaultActions' }) do
- flex_layout do |header_actions|
- header_actions.with_column(mr: 2) do
- render(Primer::Alpha::ActionMenu.new(anchor_align: :end,
- select_variant: :single,
- size: :small,
- dynamic_label: true,
- dynamic_label_prefix: I18n.t('sharing.filter.type'),
- color: :muted,
- data: { 'test-selector': 'op-share-dialog-filter-type' })) do |menu|
- menu.with_show_button(scheme: :invisible, color: :muted, data: { 'test-selector': 'op-share-dialog-filter-type-button' }) do |button|
- button.with_trailing_action_icon(icon: "triangle-down")
- I18n.t('sharing.filter.type')
- end
- type_filter_options.each do |option|
- menu.with_item(label: option[:label],
- href: filter_url(type_option: option),
- method: :get,
- tag: :a,
- active: type_filter_option_active?(option),
- role: "menuitem")
- end
- end
- end
-
- header_actions.with_column do
- render(Primer::Alpha::ActionMenu.new(anchor_align: :end,
- select_variant: :single,
- size: :small,
- dynamic_label: true,
- dynamic_label_prefix: I18n.t('sharing.filter.role'),
- color: :muted,
- data: { 'test-selector': 'op-share-dialog-filter-role' })) do |menu|
- menu.with_show_button(scheme: :invisible, color: :muted, data: { 'test-selector': 'op-share-dialog-filter-role-button' }) do |button|
- button.with_trailing_action_icon(icon: "triangle-down")
- I18n.t('sharing.filter.role')
- end
- strategy.available_roles.each do |role_hash|
- menu.with_item(label: role_hash[:label],
- href: filter_url(role_option: role_hash),
- method: :get,
- tag: :a,
- active: role_filter_option_active?(role_hash),
- role: "menuitem")
- end
- end
- end
- end
- end
-
- header_grid.with_area(:actions,
- tag: :div,
- hidden: true, # Prevent flicker on initial render
- data: { 'shares--bulk-selection-target': 'bulkActions' }) do
- if strategy.manageable?
- concat(render(Shares::BulkPermissionButtonComponent.new(strategy:)))
-
- concat(
- form_with(url: url_for([:bulk, entity, Member]),
- method: :delete,
- data: { 'shares--bulk-selection-target': 'bulkForm' }) do
- render(Primer::Beta::IconButton.new(icon: "trash",
- type: :submit,
- scheme: :danger,
- "aria-label": I18n.t('sharing.remove'),
- test_selector: 'op-share-dialog--bulk-remove'))
- end
- )
- end
- end
- end
- end
-
- if strategy.shares.none?
- border_box.with_row do
- if strategy.custom_empty_state_component?
- render(strategy.empty_state_component.new(strategy: strategy))
- else
- render(Shares::EmptyStateComponent.new(strategy: strategy))
- end
- end
- else
- strategy.shares.each do |share|
- render(Shares::ShareRowComponent.new(share:, strategy:, container: border_box))
- end
- end
- end
- end
+ render(strategy.manage_shares_component(modal_content:, errors:))
end
end
%>
diff --git a/app/components/shares/modal_body_component.rb b/app/components/shares/modal_body_component.rb
index 6e69008d4ef..93500c696c0 100644
--- a/app/components/shares/modal_body_component.rb
+++ b/app/components/shares/modal_body_component.rb
@@ -28,160 +28,21 @@
module Shares
class ModalBodyComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
- include ApplicationHelper
- include MemberHelper
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
attr_reader :strategy,
- :entity,
:errors
def initialize(strategy:, errors: nil)
super
@strategy = strategy
- @entity = strategy.entity
@errors = errors
end
def self.wrapper_key
"share_modal_body"
end
-
- private
-
- def project_scoped_entity?
- entity.respond_to?(:project)
- end
-
- def insert_target_modified?
- true
- end
-
- def insert_target_modifier_id
- "op-share-dialog-active-shares"
- end
-
- def type_filter_options
- if project_scoped_entity?
- [
- { label: I18n.t("sharing.filter.project_member"),
- value: { principal_type: "User", project_member: true } },
- { label: I18n.t("sharing.filter.not_project_member"),
- value: { principal_type: "User", project_member: false } },
- { label: I18n.t("sharing.filter.project_group"),
- value: { principal_type: "Group", project_member: true } },
- { label: I18n.t("sharing.filter.not_project_group"),
- value: { principal_type: "Group", project_member: false } }
- ]
- else
- [
- { label: I18n.t("sharing.filter.user"), value: { principal_type: "User" } },
- { label: I18n.t("sharing.filter.group"), value: { principal_type: "Group" } }
- ]
-
- end
- end
-
- def type_filter_option_active?(option) # rubocop:disable Metrics/AbcSize
- principal_type_filter_value = current_filter_value(params[:filters], "principal_type")
- project_member_filter_value = current_filter_value(params[:filters], "also_project_member")
-
- return false if principal_type_filter_value.nil?
- return false if project_scoped_entity? && project_member_filter_value.nil?
-
- principal_type_checked =
- option[:value][:principal_type] == principal_type_filter_value
- membership_selected = !project_scoped_entity? ||
- option[:value][:project_member] == ActiveRecord::Type::Boolean.new.cast(project_member_filter_value)
-
- principal_type_checked && membership_selected
- end
-
- def role_filter_option_active?(option)
- role_filter_value = current_filter_value(params[:filters], "role_id")
-
- return false if role_filter_value.nil?
-
- selected_role = strategy.available_roles.find { _1[:value] == option[:value] }
-
- selected_role[:value] == role_filter_value.to_i
- end
-
- def filter_url(type_option: nil, role_option: nil)
- return url_for([@entity, Member]) if type_option.nil? && role_option.nil?
-
- args = {}
- filter = []
-
- filter += apply_role_filter(role_option)
- filter += apply_type_filter(type_option)
-
- args[:filters] = filter.to_json unless filter.empty?
-
- url_for([@entity, Member, args])
- end
-
- def apply_role_filter(option)
- current_role_filter_value = current_filter_value(params[:filters], "role_id")
- filter = []
-
- if option.nil? && current_role_filter_value.present?
- # When there is already a role filter set and no new value passed, we want to keep that filter
- filter = role_filter_for({ value: current_role_filter_value })
- elsif option.present? && !role_filter_option_active?(option)
- # Only when the passed filter option is not the currently selected one, we apply the filter
- filter = role_filter_for(option)
- end
-
- filter
- end
-
- def role_filter_for(option)
- [
- { role_id: { operator: "=", values: [option[:value]] } }
- ]
- end
-
- def apply_type_filter(option)
- current_type_filter_value = current_filter_value(params[:filters], "principal_type")
- current_member_filter_value = current_filter_value(params[:filters], "also_project_member")
- filter = []
-
- if option.nil? && current_type_filter_value.present? && current_member_filter_value.present?
- # When there is already a type filter set and no new value passed, we want to keep that filter
- value = { value: { principal_type: current_type_filter_value, project_member: current_member_filter_value } }
- filter = type_filter_for(value)
- elsif option.present? && !type_filter_option_active?(option)
- # Only when the passed filter option is not the currently selected one, we apply the filter
- filter = type_filter_for(option)
- end
-
- filter
- end
-
- def type_filter_for(option)
- filter = [
- { principal_type: { operator: "=", values: [option[:value][:principal_type]] } }
- ]
-
- if project_scoped_entity?
- if ActiveRecord::Type::Boolean.new.cast(option[:value][:project_member])
- filter.push({ also_project_member: { operator: "=", values: [OpenProject::Database::DB_VALUE_TRUE] } })
- else
- filter.push({ also_project_member: { operator: "=", values: [OpenProject::Database::DB_VALUE_FALSE] } })
- end
- end
-
- filter
- end
-
- def current_filter_value(filters, filter_key)
- return nil if filters.nil?
-
- given_filters = JSON.parse(filters).find { |key| key.key?(filter_key) }
- given_filters ? given_filters[filter_key]["values"].first : nil
- end
end
end
diff --git a/app/components/shares/project_queries/upsale_component.html.erb b/app/components/shares/project_queries/upsale_component.html.erb
new file mode 100644
index 00000000000..fe555d91b29
--- /dev/null
+++ b/app/components/shares/project_queries/upsale_component.html.erb
@@ -0,0 +1,17 @@
+<%=
+ modal_content.with_row(data: { 'test-selector': 'op-share-dialog-upsale-block' }) do
+ render Primer::Beta::Blankslate.new(border: true) do |component|
+ component.with_visual_icon(icon: :'op-enterprise-addons', classes: 'upsale-colored')
+ component.with_heading(tag: :h2, classes: 'upsale-colored').with_content(I18n.t(:label_enterprise_addon))
+ component.with_description { I18n.t('sharing.project_queries.upsale.message') }
+
+ href = "#{OpenProject::Static::Links.links[:upsale][:href]}/?utm_source=unknown&utm_medium=community-edition&utm_campaign=project-list-sharing-modal"
+ component.with_secondary_action(href:) do
+ flex_layout(justify_content: :center) do |flex|
+ flex.with_column(mr: 1) { I18n.t("admin.enterprise.enterprise_link") }
+ flex.with_column { render(Primer::Beta::Octicon.new(icon: :'link-external')) }
+ end
+ end
+ end
+ end
+%>
diff --git a/app/components/shares/project_queries/upsale_component.rb b/app/components/shares/project_queries/upsale_component.rb
new file mode 100644
index 00000000000..dfc4df1e2dd
--- /dev/null
+++ b/app/components/shares/project_queries/upsale_component.rb
@@ -0,0 +1,43 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Shares
+ module ProjectQueries
+ class UpsaleComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
+ include OpPrimer::ComponentHelpers
+
+ def initialize(modal_content:)
+ super
+
+ @modal_content = modal_content
+ end
+
+ attr_reader :modal_content
+ end
+ end
+end
diff --git a/app/models/sharing_strategies/base_strategy.rb b/app/models/sharing_strategies/base_strategy.rb
index deb9523fae1..ce621df63fc 100644
--- a/app/models/sharing_strategies/base_strategy.rb
+++ b/app/models/sharing_strategies/base_strategy.rb
@@ -89,6 +89,10 @@ module SharingStrategies
Shares::ModalBodyComponent.new(strategy: self, errors:)
end
+ def manage_shares_component(modal_content:, errors:)
+ Shares::ManageSharesComponent.new(strategy: self, modal_content:, errors:)
+ end
+
def query # rubocop:disable Metrics/AbcSize
return @query if defined?(@query)
diff --git a/app/models/sharing_strategies/project_query_strategy.rb b/app/models/sharing_strategies/project_query_strategy.rb
index 12008d72acf..bb950af5755 100644
--- a/app/models/sharing_strategies/project_query_strategy.rb
+++ b/app/models/sharing_strategies/project_query_strategy.rb
@@ -105,6 +105,14 @@ module SharingStrategies
end
end
+ def manage_shares_component(modal_content:, errors:)
+ if EnterpriseToken.allows_to?(:project_list_sharing)
+ super
+ else
+ Shares::ProjectQueries::UpsaleComponent.new(modal_content:)
+ end
+ end
+
private
def virtual_owner_share
diff --git a/app/services/authorization/enterprise_service.rb b/app/services/authorization/enterprise_service.rb
index d6d373f693b..8f0ee66dacd 100644
--- a/app/services/authorization/enterprise_service.rb
+++ b/app/services/authorization/enterprise_service.rb
@@ -50,6 +50,7 @@ class Authorization::EnterpriseService
one_drive_sharepoint_file_storage
virus_scanning
gantt_pdf_export
+ project_list_sharing
).freeze
def initialize(token)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d8be3a8635d..531b5fa9724 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3719,6 +3719,8 @@ en:
view_description: "Can view this project list."
edit: "Edit"
edit_description: "Can view, share and edit this project list."
+ upsale:
+ message: "Sharing project lists with individual users is an enterprise add-on."
working_days:
info: >
Days that are not selected are skipped when scheduling work packages (and not included in the day count).