Admin setting to disable default follows (#12566)

master
Alice Gaudon 5 years ago committed by Eugen Rochko
parent 8094955461
commit 668f698077
  1. 22
      app/javascript/packs/admin.js
  2. 2
      app/models/form/admin_settings.rb
  3. 2
      app/services/bootstrap_timeline_service.rb
  4. 7
      app/views/admin/settings/edit.html.haml
  5. 2
      config/locales/en.yml
  6. 1
      config/settings.yml

@ -45,7 +45,25 @@ const onDomainBlockSeverityChange = (target) => {
delegate(document, '#domain_block_severity', 'change', ({ target }) => onDomainBlockSeverityChange(target)); delegate(document, '#domain_block_severity', 'change', ({ target }) => onDomainBlockSeverityChange(target));
const onEnableBootstrapTimelineAccountsChange = (target) => {
const bootstrapTimelineAccountsField = document.querySelector('#form_admin_settings_bootstrap_timeline_accounts');
if (bootstrapTimelineAccountsField) {
bootstrapTimelineAccountsField.disabled = !target.checked;
if (target.checked) {
bootstrapTimelineAccountsField.parentElement.classList.remove('disabled');
} else {
bootstrapTimelineAccountsField.parentElement.classList.add('disabled');
}
}
};
delegate(document, '#form_admin_settings_enable_bootstrap_timeline_accounts', 'change', ({ target }) => onEnableBootstrapTimelineAccountsChange(target));
ready(() => { ready(() => {
const input = document.getElementById('domain_block_severity'); const domainBlockSeverityInput = document.getElementById('domain_block_severity');
if (input) onDomainBlockSeverityChange(input); if (domainBlockSeverityInput) onDomainBlockSeverityChange(domainBlockSeverityInput);
const enableBootstrapTimelineAccounts = document.getElementById('form_admin_settings_enable_bootstrap_timeline_accounts');
if (enableBootstrapTimelineAccounts) onEnableBootstrapTimelineAccountsChange(enableBootstrapTimelineAccounts);
}); });

@ -16,6 +16,7 @@ class Form::AdminSettings
open_deletion open_deletion
timeline_preview timeline_preview
show_staff_badge show_staff_badge
enable_bootstrap_timeline_accounts
bootstrap_timeline_accounts bootstrap_timeline_accounts
theme theme
min_invite_role min_invite_role
@ -40,6 +41,7 @@ class Form::AdminSettings
open_deletion open_deletion
timeline_preview timeline_preview
show_staff_badge show_staff_badge
enable_bootstrap_timeline_accounts
activity_api_enabled activity_api_enabled
peers_api_enabled peers_api_enabled
show_known_fediverse_at_about_page show_known_fediverse_at_about_page

@ -5,7 +5,7 @@ class BootstrapTimelineService < BaseService
@source_account = source_account @source_account = source_account
autofollow_inviter! autofollow_inviter!
autofollow_bootstrap_timeline_accounts! autofollow_bootstrap_timeline_accounts! if Setting.enable_bootstrap_timeline_accounts
end end
private private

@ -1,3 +1,6 @@
- content_for :header_tags do
= javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
- content_for :page_title do - content_for :page_title do
= t('admin.settings.title') = t('admin.settings.title')
@ -38,7 +41,9 @@
%hr.spacer/ %hr.spacer/
.fields-group .fields-group
= f.input :bootstrap_timeline_accounts, wrapper: :with_block_label, label: t('admin.settings.bootstrap_timeline_accounts.title'), hint: t('admin.settings.bootstrap_timeline_accounts.desc_html') = f.input :enable_bootstrap_timeline_accounts, as: :boolean, wrapper: :with_label, label: t('admin.settings.enable_bootstrap_timeline_accounts.title')
.fields-group
= f.input :bootstrap_timeline_accounts, wrapper: :with_block_label, label: t('admin.settings.bootstrap_timeline_accounts.title'), hint: t('admin.settings.bootstrap_timeline_accounts.desc_html'), disabled: !Setting.enable_bootstrap_timeline_accounts
%hr.spacer/ %hr.spacer/

@ -456,6 +456,8 @@ en:
users: To logged-in local users users: To logged-in local users
domain_blocks_rationale: domain_blocks_rationale:
title: Show rationale title: Show rationale
enable_bootstrap_timeline_accounts:
title: Enable default follows for new users
hero: hero:
desc_html: Displayed on the frontpage. At least 600x100px recommended. When not set, falls back to server thumbnail desc_html: Displayed on the frontpage. At least 600x100px recommended. When not set, falls back to server thumbnail
title: Hero image title: Hero image

@ -61,6 +61,7 @@ defaults: &defaults
- mod - mod
- moderator - moderator
disallowed_hashtags: # space separated string or list of hashtags without the hash disallowed_hashtags: # space separated string or list of hashtags without the hash
enable_bootstrap_timeline_accounts: true
bootstrap_timeline_accounts: '' bootstrap_timeline_accounts: ''
activity_api_enabled: true activity_api_enabled: true
peers_api_enabled: true peers_api_enabled: true

Loading…
Cancel
Save