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

Add an access warning

Klaus Zanders18c1f1a50e93
diff --git a/app/components/shares/project_queries/project_access_warning_component.html.erb b/app/components/shares/project_queries/project_access_warning_component.html.erb
new file mode 100644
index 00000000000..3e9558fe38d
--- /dev/null
+++ b/app/components/shares/project_queries/project_access_warning_component.html.erb
@@ -0,0 +1,3 @@
+<%- if query_is_public? || query_is_shared? %>
+ <%= container.with_row(mt: 3) { render(Primer::Alpha::Banner.new(icon: :info)) { I18n.t('sharing.project_queries.access_warning') } }%>
+<%- end %>
diff --git a/app/components/shares/project_queries/project_access_warning_component.rb b/app/components/shares/project_queries/project_access_warning_component.rb
new file mode 100644
index 00000000000..97b76a75d61
--- /dev/null
+++ b/app/components/shares/project_queries/project_access_warning_component.rb
@@ -0,0 +1,26 @@
+module Shares
+ module ProjectQueries
+ class ProjectAccessWarningComponent < ViewComponent::Base # rubocop:disable OpenProject/AddPreviewForViewComponent
+ include OpPrimer::ComponentHelpers
+
+ def initialize(strategy:, modal_body_container:)
+ super
+
+ @strategy = strategy
+ @container = modal_body_container
+ end
+
+ private
+
+ attr_reader :strategy, :container
+
+ def query_is_public?
+ @strategy.entity.public?
+ end
+
+ def query_is_shared?
+ @strategy.entity.members.any?
+ end
+ end
+ end
+end