Add privacy tab in profile settings (#26484)
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>th-downstream
parent
89b675cb07
commit
738b024d0c
@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Settings::PrivacyController < Settings::BaseController
|
||||
before_action :set_account
|
||||
|
||||
def show; end
|
||||
|
||||
def update
|
||||
if UpdateAccountService.new.call(@account, account_params.except(:settings))
|
||||
current_user.update!(settings_attributes: account_params[:settings])
|
||||
ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
|
||||
redirect_to settings_privacy_path, notice: I18n.t('generic.changes_saved_msg')
|
||||
else
|
||||
render :show
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def account_params
|
||||
params.require(:account).permit(:discoverable, :locked, :hide_collections, settings: UserSettings.keys)
|
||||
end
|
||||
|
||||
def set_account
|
||||
@account = current_account
|
||||
end
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
- content_for :page_title do
|
||||
= t('privacy.title')
|
||||
|
||||
- content_for :heading do
|
||||
%h2= t('settings.profile')
|
||||
= render partial: 'settings/shared/profile_navigation'
|
||||
|
||||
= simple_form_for @account, url: settings_privacy_path, html: { method: :put } do |f|
|
||||
= render 'shared/error_messages', object: @account
|
||||
|
||||
%p.lead= t('privacy.hint_html')
|
||||
|
||||
%h4= t('privacy.reach')
|
||||
|
||||
%p.lead= t('privacy.reach_hint_html')
|
||||
|
||||
.fields-group
|
||||
= f.input :discoverable, as: :boolean, wrapper: :with_label, recommended: true
|
||||
|
||||
.fields-group
|
||||
= f.input :locked, as: :boolean, wrapper: :with_label
|
||||
|
||||
%h4= t('privacy.search')
|
||||
|
||||
%p.lead= t('privacy.search_hint_html')
|
||||
|
||||
= f.simple_fields_for :settings, current_user.settings do |ff|
|
||||
.fields-group
|
||||
= ff.input :indexable, wrapper: :with_label
|
||||
|
||||
%h4= t('privacy.privacy')
|
||||
|
||||
%p.lead= t('privacy.privacy_hint_html')
|
||||
|
||||
.fields-group
|
||||
= f.input :hide_collections, as: :boolean, wrapper: :with_label
|
||||
|
||||
= f.simple_fields_for :settings, current_user.settings do |ff|
|
||||
.fields-group
|
||||
= ff.input :show_application, wrapper: :with_label
|
||||
|
||||
.actions
|
||||
= f.button :button, t('generic.save_changes'), type: :submit
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue