Allow users to delete their own accounts

This PR allows users to delete their own accounts. The logic implemented matches
that currently used by the admins when they manually close accounts, although
there is room to be more complex in future e.g. completely removing accounts
with no content.

The error handling has been slightly adapted for namespaced controllers, by
anchoring the controller name with a leading forward slash.
This commit is contained in:
Andy Allan 2021-12-09 16:12:42 +00:00
parent af273f5d6a
commit 6c1d73a509
10 changed files with 142 additions and 5 deletions

View file

@ -0,0 +1,38 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<%= render :partial => "settings_menu" %>
<div class="alert alert-danger row mx-0 p-3 align-items-center">
<div class="col-auto">
<picture>
<source srcset="<%= image_path "notice.svg" %>" type="image/svg+xml"></source>
<%= image_tag("notice.png", :srcset => image_path("notice.svg")) %>
</picture>
</div>
<div class="col">
<p class="mb-0"><%= t ".warning" %></p>
</div>
</div>
<p><%= t ".delete_introduction" %></p>
<ul>
<li><%= t ".delete_profile" %></li>
<li><%= t ".delete_display_name" %></li>
</ul>
<p><%= t ".retain_caveats" %></p>
<ul>
<li><%= t ".retain_edits" %></li>
<li><%= t ".retain_traces" %></li>
<li><%= t ".retain_diary_entries" %></li>
<li><%= t ".retain_notes" %></li>
<li><%= t ".retain_changeset_discussions" %></li>
<li><%= t ".retain_email" %></li>
</ul>
<%= link_to t(".delete_account"), account_path, { :method => :delete, :class => "btn btn-danger", :data => { :confirm => t(".confirm_delete") } } %>
<%= link_to t(".cancel"), edit_account_path, :class => "btn btn-link" %>