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

[50233] Changed project deletion danger zone

Andreas Pfohl459dcf0edaa1
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index fbe354fae79..5804cee5fa2 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -40,6 +40,8 @@ class ProjectsController < ApplicationController
include QueriesHelper
include ProjectsHelper
+ helper_method :has_managed_project_folders?
+
current_menu_item :index do
:projects
end
@@ -96,6 +98,10 @@ class ProjectsController < ApplicationController
private
+ def has_managed_project_folders?(project)
+ project.project_storages.any?(&:project_folder_automatic?)
+ end
+
def find_optional_project
return true unless params[:id]
diff --git a/app/views/projects/destroy_info.html.erb b/app/views/projects/destroy_info.html.erb
index cf7ce4897e8..0545be44b06 100644
--- a/app/views/projects/destroy_info.html.erb
+++ b/app/views/projects/destroy_info.html.erb
@@ -34,31 +34,37 @@ See COPYRIGHT and LICENSE files for more details.
<%= t('project.destroy.title', name: "<em>#{h(@project_to_destroy)}</em>").html_safe %>
</h3>
<p>
- <%= t('project.destroy.confirmation', identifier: @project_to_destroy.identifier)%>
+ <%= t('project.destroy.confirmation', identifier: @project_to_destroy.identifier) %>
<% if @project_to_destroy.descendants.any? %>
- <br />
- <% descendants = h(@project_to_destroy.descendants.collect{|p| p.to_s}.join(', ')) %>
+ <br/>
+ <% descendants = h(@project_to_destroy.descendants.collect { |p| p.to_s }.join(', ')) %>
<%= t('project.destroy.subprojects_confirmation', value: "<strong>#{h(descendants)}</strong>").html_safe %>
<% end %>
</p>
+ <ul class="mb-3">
+ <li> <%= t('project.destroy.project_delete_result_1') %> </li>
+ <% if has_managed_project_folders?(@project_to_destroy) %>
+ <li> <%= t('project.destroy.project_delete_result_2') %> </li>
+ <% end %>
+ </ul>
<p class="danger-zone--warning">
<span class="icon icon-error"></span>
- <span><%= t('project.destroy.info')%></span>
+ <span><%= t('project.destroy.info') %></span>
</p>
<p>
<%= t('project.destroy.project_verification', name: "<em class=\"danger-zone--expected-value\">#{h(@project_to_destroy)}</em>").html_safe %>
</p>
<div class="danger-zone--verification">
- <input type="text"></input>
+ <input type="text">
<%= styled_button_tag title: t(:button_delete), class: '-highlight', disabled: true do
- concat content_tag :i, '', class: 'button--icon icon-delete'
- concat content_tag :span, t(:button_delete), class: 'button--text'
- end %>
+ concat content_tag :i, '', class: 'button--icon icon-delete'
+ concat content_tag :span, t(:button_delete), class: 'button--text'
+ end %>
<%= link_to projects_path,
- title: t(:button_cancel),
- class: 'button -with-icon icon-cancel' do %>
- <%= t(:button_cancel) %>
- <% end %>
+ title: t(:button_cancel),
+ class: 'button -with-icon icon-cancel' do %>
+ <%= t(:button_cancel) %>
+ <% end %>
</div>
</section>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 413d4ec4502..41260d788f0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2616,7 +2616,9 @@ en:
project:
destroy:
- confirmation: "If you continue, the project %{identifier} and all related data will be permanently destroyed."
+ confirmation: "If you continue, the project %{identifier} will be permanently destroyed. To confirm this action please introduce the project name in the field below, this will:"
+ project_delete_result_1: "Delete all related data."
+ project_delete_result_2: "Delete all managed project folders in the attached storages."
info: "Deleting the project is an irreversible action."
project_verification: "Enter the project's name %{name} to verify the deletion."
subprojects_confirmation: "Its subproject(s): %{value} will also be deleted."