Skip to content

Commit

Permalink
Change "Allow trends without prior review" setting to include statuses (
Browse files Browse the repository at this point in the history
mastodon#17977)

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

* Fix i18n-tasks
  • Loading branch information
Gargron authored and aescling committed Nov 17, 2022
1 parent b045f46 commit e635f7e
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 7 deletions.
9 changes: 8 additions & 1 deletion app/javascript/styles/mastodon/accounts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@
}

.account-role,
.simple_form .recommended {
.simple_form .recommended,
.simple_form .not_recommended {
display: inline-block;
padding: 4px 6px;
cursor: default;
Expand All @@ -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 {
max-width: 100vw;
padding: 0;
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/styles/mastodon/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ code {
}
}

.recommended {
.recommended,
.not_recommended {
position: absolute;
margin: 0 4px;
margin-top: -2px;
Expand Down
4 changes: 4 additions & 0 deletions app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ def memorialize!
update!(memorial: true)
end

def trendable
boolean_with_default('trendable', Setting.trendable_by_default)
end

def sign?
true
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/settings/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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')

.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
= f.input :trending_status_cw, as: :boolean, wrapper: :with_label, label: t('admin.settings.trending_status_cw.title'), hint: t('admin.settings.trending_status_cw.desc_html')
Expand Down
2 changes: 1 addition & 1 deletion config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ignore_unused:
- 'activerecord.errors.*'
- '{devise,pagination,doorkeeper}.*'
- '{date,datetime,time,number}.*'
- 'simple_form.{yes,no,recommended}'
- 'simple_form.{yes,no,recommended,not_recommended}'
- 'simple_form.{placeholders,hints,labels}.*'
- 'simple_form.{error_notification,required}.:'
- 'errors.messages.*'
Expand Down
5 changes: 4 additions & 1 deletion config/initializers/simple_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ def append(_wrapper_options = nil)
module RecommendedComponent
def recommended(_wrapper_options = nil)
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
end
end
Expand Down
4 changes: 2 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,8 @@ en:
title: Allow unauthenticated access to public timeline
title: Site settings
trendable_by_default:
desc_html: Affects hashtags that have not been previously disallowed
title: Allow hashtags to trend without prior review
desc_html: Specific trending content can still be explicitly disallowed
title: Allow trends without prior review
trends:
desc_html: Publicly display previously reviewed content that is currently trending
title: Trends
Expand Down
1 change: 1 addition & 0 deletions config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ en:
events: Enabled events
url: Endpoint URL
'no': 'No'
not_recommended: Not recommended
recommended: Recommended
required:
mark: "*"
Expand Down

0 comments on commit e635f7e

Please sign in to comment.