From 9c8f1925dc91bb47385c88fd2ef00a522eca7029 Mon Sep 17 00:00:00 2001 From: Plastikmensch Date: Tue, 7 Mar 2023 14:14:17 +0100 Subject: [PATCH] Add option to allow toots with sensitive media to trend Signed-off-by: Plastikmensch --- app/models/form/admin_settings.rb | 2 ++ app/models/trends/statuses.rb | 2 +- app/views/admin/settings/discovery/show.html.haml | 3 +++ config/locales-glitch/en.yml | 3 +++ config/settings.yml | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index 095733673e..aca3d13eab 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -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 @@ -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 diff --git a/app/models/trends/statuses.rb b/app/models/trends/statuses.rb index 4b113bfd79..3e3ebc2c9c 100644 --- a/app/models/trends/statuses.rb +++ b/app/models/trends/statuses.rb @@ -106,7 +106,7 @@ class Trends::Statuses < Trends::Base 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) diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml index 12c122393b..858b35c958 100644 --- a/app/views/admin/settings/discovery/show.html.haml +++ b/app/views/admin/settings/discovery/show.html.haml @@ -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 diff --git a/config/locales-glitch/en.yml b/config/locales-glitch/en.yml index 1485ee174d..c14b2ef1ad 100644 --- a/config/locales-glitch/en.yml +++ b/config/locales-glitch/en.yml @@ -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 diff --git a/config/settings.yml b/config/settings.yml index c9c37a6f71..7038926b35 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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