Kaynağa Gözat

Admin setting to disable default follows (#12566)

master^2
Alice Gaudon 4 yıl önce
committed by Eugen Rochko
ebeveyn
işleme
668f698077
6 değiştirilmiş dosya ile 32 ekleme ve 4 silme
  1. +20
    -2
      app/javascript/packs/admin.js
  2. +2
    -0
      app/models/form/admin_settings.rb
  3. +1
    -1
      app/services/bootstrap_timeline_service.rb
  4. +6
    -1
      app/views/admin/settings/edit.html.haml
  5. +2
    -0
      config/locales/en.yml
  6. +1
    -0
      config/settings.yml

+ 20
- 2
app/javascript/packs/admin.js Dosyayı Görüntüle

@@ -45,7 +45,25 @@ const 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(() => {
const input = document.getElementById('domain_block_severity');
if (input) onDomainBlockSeverityChange(input);
const domainBlockSeverityInput = document.getElementById('domain_block_severity');
if (domainBlockSeverityInput) onDomainBlockSeverityChange(domainBlockSeverityInput);

const enableBootstrapTimelineAccounts = document.getElementById('form_admin_settings_enable_bootstrap_timeline_accounts');
if (enableBootstrapTimelineAccounts) onEnableBootstrapTimelineAccountsChange(enableBootstrapTimelineAccounts);
});

+ 2
- 0
app/models/form/admin_settings.rb Dosyayı Görüntüle

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


+ 1
- 1
app/services/bootstrap_timeline_service.rb Dosyayı Görüntüle

@@ -5,7 +5,7 @@ class BootstrapTimelineService < BaseService
@source_account = source_account

autofollow_inviter!
autofollow_bootstrap_timeline_accounts!
autofollow_bootstrap_timeline_accounts! if Setting.enable_bootstrap_timeline_accounts
end

private


+ 6
- 1
app/views/admin/settings/edit.html.haml Dosyayı Görüntüle

@@ -1,3 +1,6 @@
- content_for :header_tags do
= javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'

- content_for :page_title do
= t('admin.settings.title')

@@ -38,7 +41,9 @@
%hr.spacer/

.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/



+ 2
- 0
config/locales/en.yml Dosyayı Görüntüle

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


+ 1
- 0
config/settings.yml Dosyayı Görüntüle

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


Yükleniyor…
İptal
Kaydet