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

Hide share button in header component if user can't view shares

Aaron Contreras58fd4fe0faba
diff --git a/app/components/projects/index_page_header_component.html.erb b/app/components/projects/index_page_header_component.html.erb
index 8762ae35bd2..357fa53cdf2 100644
--- a/app/components/projects/index_page_header_component.html.erb
+++ b/app/components/projects/index_page_header_component.html.erb
@@ -21,7 +21,7 @@
)
end
- if query.persisted? && OpenProject::FeatureDecisions.project_list_sharing_active?
+ if query.persisted? && OpenProject::FeatureDecisions.project_list_sharing_active? && can_view_shares?
header.with_action_icon_button(
tag: :a,
href: dialog_project_query_members_path(query),
diff --git a/app/components/projects/index_page_header_component.rb b/app/components/projects/index_page_header_component.rb
index 84ebd067913..66002839666 100644
--- a/app/components/projects/index_page_header_component.rb
+++ b/app/components/projects/index_page_header_component.rb
@@ -88,6 +88,10 @@ class Projects::IndexPageHeaderComponent < ApplicationComponent
query.editable?
end
+ def can_view_shares?
+ query.visible? || query.editable?
+ end
+
def show_state?
state == :show
end