about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-10-06 10:16:47 +0200
committerGitHub <noreply@github.com>2022-10-06 10:16:47 +0200
commit93f340a4bf35082968118319448905b489b101a3 (patch)
treea5029b7ea58485c6816ff534c00e7cc75d6818f8
parent62782babd08bc2385a604e275bf88af925d137c1 (diff)
Remove setting that disables account deletes (#17683)
-rw-r--r--app/controllers/settings/deletes_controller.rb5
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/models/form/admin_settings.rb2
-rw-r--r--app/views/admin/settings/edit.html.haml3
-rw-r--r--app/views/auth/registrations/edit.html.haml7
-rw-r--r--app/views/settings/profiles/show.html.haml7
-rw-r--r--config/locales/en.yml3
-rw-r--r--spec/controllers/settings/deletes_controller_spec.rb14
8 files changed, 6 insertions, 39 deletions
diff --git a/app/controllers/settings/deletes_controller.rb b/app/controllers/settings/deletes_controller.rb
index e0dd5edcb..bb096567a 100644
--- a/app/controllers/settings/deletes_controller.rb
+++ b/app/controllers/settings/deletes_controller.rb
@@ -4,7 +4,6 @@ class Settings::DeletesController < Settings::BaseController
   skip_before_action :require_functional!
 
   before_action :require_not_suspended!
-  before_action :check_enabled_deletion
 
   def show
     @confirmation = Form::DeleteConfirmation.new
@@ -21,10 +20,6 @@ class Settings::DeletesController < Settings::BaseController
 
   private
 
-  def check_enabled_deletion
-    redirect_to root_path unless Setting.open_deletion
-  end
-
   def resource_params
     params.require(:form_delete_confirmation).permit(:password, :username)
   end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 14d27b148..23884fbd4 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -87,10 +87,6 @@ module ApplicationHelper
     link_to label, omniauth_authorize_path(:user, provider), class: "button button-#{provider}", method: :post
   end
 
-  def open_deletion?
-    Setting.open_deletion
-  end
-
   def locale_direction
     if RTL_LOCALES.include?(I18n.locale)
       'rtl'
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index e744344c5..7bd9e3743 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -13,7 +13,6 @@ class Form::AdminSettings
     site_terms
     registrations_mode
     closed_registrations_message
-    open_deletion
     timeline_preview
     bootstrap_timeline_accounts
     theme
@@ -37,7 +36,6 @@ class Form::AdminSettings
   ).freeze
 
   BOOLEAN_KEYS = %i(
-    open_deletion
     timeline_preview
     activity_api_enabled
     peers_api_enabled
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index a00cd0222..79f73a60f 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -57,9 +57,6 @@
     .fields-group
       = f.input :timeline_preview, as: :boolean, wrapper: :with_label, label: t('admin.settings.timeline_preview.title'), hint: t('admin.settings.timeline_preview.desc_html')
 
-  .fields-group
-    = f.input :open_deletion, as: :boolean, wrapper: :with_label, label: t('admin.settings.registrations.deletion.title'), hint: t('admin.settings.registrations.deletion.desc_html')
-
   - unless whitelist_mode?
     .fields-group
       = f.input :activity_api_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.activity_api_enabled.title'), hint: t('admin.settings.activity_api_enabled.desc_html'), recommended: true
diff --git a/app/views/auth/registrations/edit.html.haml b/app/views/auth/registrations/edit.html.haml
index a3445b421..df929e3e8 100644
--- a/app/views/auth/registrations/edit.html.haml
+++ b/app/views/auth/registrations/edit.html.haml
@@ -41,8 +41,7 @@
   %h3= t('migrations.incoming_migrations')
   %p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path)
 
-  - if open_deletion?
-    %hr.spacer/
+  %hr.spacer/
 
-    %h3= t('auth.delete_account')
-    %p.muted-hint= t('auth.delete_account_html', path: settings_delete_path)
+  %h3= t('auth.delete_account')
+  %p.muted-hint= t('auth.delete_account_html', path: settings_delete_path)
diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml
index fe9666d84..3067b3737 100644
--- a/app/views/settings/profiles/show.html.haml
+++ b/app/views/settings/profiles/show.html.haml
@@ -70,8 +70,7 @@
 %h6= t 'migrations.incoming_migrations'
 %p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path)
 
-- if open_deletion?
-  %hr.spacer/
+%hr.spacer/
 
-  %h6= t('auth.delete_account')
-  %p.muted-hint= t('auth.delete_account_html', path: settings_delete_path)
+%h6= t('auth.delete_account')
+%p.muted-hint= t('auth.delete_account_html', path: settings_delete_path)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index b41e4f47b..505a2f9fc 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -754,9 +754,6 @@ en:
         closed_message:
           desc_html: Displayed on frontpage when registrations are closed. You can use HTML tags
           title: Closed registration message
-        deletion:
-          desc_html: Allow anyone to delete their account
-          title: Open account deletion
         require_invite_text:
           desc_html: When registrations require manual approval, make the “Why do you want to join?” text input mandatory rather than optional
           title: Require new users to enter a reason to join
diff --git a/spec/controllers/settings/deletes_controller_spec.rb b/spec/controllers/settings/deletes_controller_spec.rb
index cd36ecc35..a94dc042a 100644
--- a/spec/controllers/settings/deletes_controller_spec.rb
+++ b/spec/controllers/settings/deletes_controller_spec.rb
@@ -81,20 +81,6 @@ describe Settings::DeletesController do
           expect(response).to redirect_to settings_delete_path
         end
       end
-
-      context 'when account deletions are disabled' do
-        around do |example|
-          open_deletion = Setting.open_deletion
-          example.run
-          Setting.open_deletion = open_deletion
-        end
-
-        it 'redirects' do
-          Setting.open_deletion = false
-          delete :destroy
-          expect(response).to redirect_to root_path
-        end
-      end
     end
 
     context 'when not signed in' do