Change "Allow trends without prior review" setting to include statuses (#17977)

* Change "Allow trends without prior review" setting to include posts

* Fix i18n-tasks
rebase/4.0.0rc1
Eugen Rochko 2022-08-28 04:00:39 +02:00 committed by GitHub
parent c57907737a
commit 546672e292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 7 deletions

View File

@ -202,7 +202,8 @@
} }
.account-role, .account-role,
.simple_form .recommended { .simple_form .recommended,
.simple_form .not_recommended {
display: inline-block; display: inline-block;
padding: 4px 6px; padding: 4px 6px;
cursor: default; cursor: default;
@ -227,6 +228,12 @@
} }
} }
.simple_form .not_recommended {
color: lighten($error-red, 12%);
background-color: rgba(lighten($error-red, 12%), 0.1);
border-color: rgba(lighten($error-red, 12%), 0.5);
}
.account__header__fields { .account__header__fields {
max-width: 100vw; max-width: 100vw;
padding: 0; padding: 0;

View File

@ -102,7 +102,8 @@ code {
} }
} }
.recommended { .recommended,
.not_recommended {
position: absolute; position: absolute;
margin: 0 4px; margin: 0 4px;
margin-top: -2px; margin-top: -2px;

View File

@ -258,6 +258,10 @@ class Account < ApplicationRecord
update!(memorial: true) update!(memorial: true)
end end
def trendable
boolean_with_default('trendable', Setting.trendable_by_default)
end
def sign? def sign?
true true
end end

View File

@ -81,7 +81,7 @@
= f.input :trends, as: :boolean, wrapper: :with_label, label: t('admin.settings.trends.title'), hint: t('admin.settings.trends.desc_html') = f.input :trends, as: :boolean, wrapper: :with_label, label: t('admin.settings.trends.title'), hint: t('admin.settings.trends.desc_html')
.fields-group .fields-group
= f.input :trendable_by_default, as: :boolean, wrapper: :with_label, label: t('admin.settings.trendable_by_default.title'), hint: t('admin.settings.trendable_by_default.desc_html') = f.input :trendable_by_default, as: :boolean, wrapper: :with_label, label: t('admin.settings.trendable_by_default.title'), hint: t('admin.settings.trendable_by_default.desc_html'), recommended: :not_recommended
.fields-group .fields-group
= f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html') = f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html')

View File

@ -51,7 +51,7 @@ ignore_unused:
- 'activerecord.errors.*' - 'activerecord.errors.*'
- '{devise,pagination,doorkeeper}.*' - '{devise,pagination,doorkeeper}.*'
- '{date,datetime,time,number}.*' - '{date,datetime,time,number}.*'
- 'simple_form.{yes,no,recommended}' - 'simple_form.{yes,no,recommended,not_recommended}'
- 'simple_form.{placeholders,hints,labels}.*' - 'simple_form.{placeholders,hints,labels}.*'
- 'simple_form.{error_notification,required}.:' - 'simple_form.{error_notification,required}.:'
- 'errors.messages.*' - 'errors.messages.*'

View File

@ -11,7 +11,10 @@ end
module RecommendedComponent module RecommendedComponent
def recommended(_wrapper_options = nil) def recommended(_wrapper_options = nil)
return unless options[:recommended] return unless options[:recommended]
options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t('simple_form.recommended'), class: 'recommended')]) }
key = options[:recommended].is_a?(Symbol) ? options[:recommended] : :recommended
options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t(key, scope: 'simple_form'), class: key)]) }
nil nil
end end
end end

View File

@ -808,8 +808,8 @@ en:
title: Allow unauthenticated access to public timeline title: Allow unauthenticated access to public timeline
title: Site settings title: Site settings
trendable_by_default: trendable_by_default:
desc_html: Affects hashtags that have not been previously disallowed desc_html: Specific trending content can still be explicitly disallowed
title: Allow hashtags to trend without prior review title: Allow trends without prior review
trends: trends:
desc_html: Publicly display previously reviewed content that is currently trending desc_html: Publicly display previously reviewed content that is currently trending
title: Trends title: Trends

View File

@ -253,6 +253,7 @@ en:
events: Enabled events events: Enabled events
url: Endpoint URL url: Endpoint URL
'no': 'No' 'no': 'No'
not_recommended: Not recommended
recommended: Recommended recommended: Recommended
required: required:
mark: "*" mark: "*"