Remove setting that disables account deletes (#17683)

This commit is contained in:
Eugen Rochko 2022-10-06 10:16:47 +02:00 committed by GitHub
parent 62782babd0
commit 93f340a4bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 6 additions and 39 deletions

View File

@ -4,7 +4,6 @@ class Settings::DeletesController < Settings::BaseController
skip_before_action :require_functional! skip_before_action :require_functional!
before_action :require_not_suspended! before_action :require_not_suspended!
before_action :check_enabled_deletion
def show def show
@confirmation = Form::DeleteConfirmation.new @confirmation = Form::DeleteConfirmation.new
@ -21,10 +20,6 @@ class Settings::DeletesController < Settings::BaseController
private private
def check_enabled_deletion
redirect_to root_path unless Setting.open_deletion
end
def resource_params def resource_params
params.require(:form_delete_confirmation).permit(:password, :username) params.require(:form_delete_confirmation).permit(:password, :username)
end end

View File

@ -87,10 +87,6 @@ module ApplicationHelper
link_to label, omniauth_authorize_path(:user, provider), class: "button button-#{provider}", method: :post link_to label, omniauth_authorize_path(:user, provider), class: "button button-#{provider}", method: :post
end end
def open_deletion?
Setting.open_deletion
end
def locale_direction def locale_direction
if RTL_LOCALES.include?(I18n.locale) if RTL_LOCALES.include?(I18n.locale)
'rtl' 'rtl'

View File

@ -13,7 +13,6 @@ class Form::AdminSettings
site_terms site_terms
registrations_mode registrations_mode
closed_registrations_message closed_registrations_message
open_deletion
timeline_preview timeline_preview
bootstrap_timeline_accounts bootstrap_timeline_accounts
theme theme
@ -37,7 +36,6 @@ class Form::AdminSettings
).freeze ).freeze
BOOLEAN_KEYS = %i( BOOLEAN_KEYS = %i(
open_deletion
timeline_preview timeline_preview
activity_api_enabled activity_api_enabled
peers_api_enabled peers_api_enabled

View File

@ -57,9 +57,6 @@
.fields-group .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') = 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? - unless whitelist_mode?
.fields-group .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 = 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

View File

@ -41,7 +41,6 @@
%h3= t('migrations.incoming_migrations') %h3= t('migrations.incoming_migrations')
%p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path) %p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path)
- if open_deletion?
%hr.spacer/ %hr.spacer/
%h3= t('auth.delete_account') %h3= t('auth.delete_account')

View File

@ -70,7 +70,6 @@
%h6= t 'migrations.incoming_migrations' %h6= t 'migrations.incoming_migrations'
%p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path) %p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path)
- if open_deletion?
%hr.spacer/ %hr.spacer/
%h6= t('auth.delete_account') %h6= t('auth.delete_account')

View File

@ -754,9 +754,6 @@ en:
closed_message: closed_message:
desc_html: Displayed on frontpage when registrations are closed. You can use HTML tags desc_html: Displayed on frontpage when registrations are closed. You can use HTML tags
title: Closed registration message title: Closed registration message
deletion:
desc_html: Allow anyone to delete their account
title: Open account deletion
require_invite_text: require_invite_text:
desc_html: When registrations require manual approval, make the “Why do you want to join?” text input mandatory rather than optional 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 title: Require new users to enter a reason to join

View File

@ -81,20 +81,6 @@ describe Settings::DeletesController do
expect(response).to redirect_to settings_delete_path expect(response).to redirect_to settings_delete_path
end end
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 end
context 'when not signed in' do context 'when not signed in' do