Skip to content

Commit

Permalink
Add an access warning
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Jul 3, 2024
1 parent d88d2ed commit 18c1f1a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 %>
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 18c1f1a

Please sign in to comment.