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

Do not display project infos on the index page

Klaus Zandersda9dc2070e76
diff --git a/app/components/projects/row_component.html.erb b/app/components/projects/row_component.html.erb
index 079fdd97e47..0a88ea78563 100644
--- a/app/components/projects/row_component.html.erb
+++ b/app/components/projects/row_component.html.erb
@@ -70,7 +70,7 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
</td>
</tr>
-<% if project.description.present? %>
+<% if User.current.allowed_in_project?(:view_project, project) && project.description.present? %>
<tr class="project-description <%= project_css_classes %> <%= row_css_level_classes %> <%= params[:expand] == 'all' ? '-expanded' : '' %>"
data-project-target="descriptionRow"
data-project-id="<%= project.id %>">
diff --git a/app/components/projects/row_component.rb b/app/components/projects/row_component.rb
index 9f2fdaf1d90..0c284e98375 100644
--- a/app/components/projects/row_component.rb
+++ b/app/components/projects/row_component.rb
@@ -52,6 +52,8 @@ module Projects
end
def custom_field_column(column)
+ return nil unless user_can_view_project?
+
cf = custom_field(column)
custom_value = project.formatted_custom_value_for(cf)
@@ -92,6 +94,8 @@ module Projects
end
def project_status
+ return nil unless user_can_view_project?
+
content = ''.html_safe
status_code = project.status_code
@@ -106,6 +110,8 @@ module Projects
end
def status_explanation
+ return nil unless user_can_view_project?
+
if project.status_explanation
content_tag :div, helpers.format_text(project.status_explanation), class: 'wiki'
end
@@ -165,5 +171,9 @@ module Projects
"format-#{cf.field_format}#{formattable}"
end
end
+
+ def user_can_view_project?
+ User.current.allowed_in_project?(:view_project, project)
+ end
end
end