Skip to content

Commit

Permalink
Add option to allow toots with sensitive media to trend
Browse files Browse the repository at this point in the history
Signed-off-by: Plastikmensch <[email protected]>
  • Loading branch information
Plastikmensch committed Jan 5, 2024
1 parent dfbf960 commit 9c8f192
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/models/form/admin_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Form::AdminSettings
trends_as_landing_page
trendable_by_default
trending_status_cw
trending_status_sensitive
show_domain_blocks
show_domain_blocks_rationale
noindex
Expand Down Expand Up @@ -66,6 +67,7 @@ class Form::AdminSettings
trends_as_landing_page
trendable_by_default
trending_status_cw
trending_status_sensitive
noindex
require_invite_text
captcha_enabled
Expand Down
2 changes: 1 addition & 1 deletion app/models/trends/statuses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def klass
private

def eligible?(status)
status.public_visibility? && status.account.discoverable? && !status.account.silenced? && !status.account.sensitized? && (status.spoiler_text.blank? || Setting.trending_status_cw) && !status.sensitive? && !status.reply? && valid_locale?(status.language)
status.public_visibility? && status.account.discoverable? && !status.account.silenced? && !status.account.sensitized? && (status.spoiler_text.blank? || Setting.trending_status_cw) && (!status.sensitive? || Setting.trending_status_sensitive) && !status.reply? && valid_locale?(status.language)
end

def calculate_scores(statuses, at_time)
Expand Down
3 changes: 3 additions & 0 deletions app/views/admin/settings/discovery/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
.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'), glitch_only: true

.fields-group
= f.input :trending_status_sensitive, as: :boolean, wrapper: :with_label, label: t('admin.settings.trending_status_sensitive.title'), hint: t('admin.settings.trending_status_sensitive.desc_html'), glitch_only: true

%h4= t('admin.settings.discovery.public_timelines')

.fields-group
Expand Down
3 changes: 3 additions & 0 deletions config/locales-glitch/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ en:
trending_status_cw:
desc_html: When trending posts are enabled, allow posts with Content Warnings to be eligible. Changes to this setting are not retroactive.
title: Allow posts with Content Warnings to trend
trending_status_sensitive:
desc_html: When trending posts are enabled, allow posts with sensitive media to be eligible. Changes to this setting are not retroactive.
title: Allow posts with sensitive media to trend
appearance:
localization:
glitch_guide_link: https://crowdin.com/project/glitch-soc
Expand Down
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ defaults: &defaults
trends_as_landing_page: true
trendable_by_default: false
trending_status_cw: true
trending_status_sensitive: false
hide_followers_count: false
reserved_usernames:
- admin
Expand Down

0 comments on commit 9c8f192

Please sign in to comment.