add in hometown's norss

https://github.com/glitch-soc/mastodon/pull/2002
This commit is contained in:
Skye 2023-02-04 19:26:59 +09:00
parent efb7f0b66a
commit b98a2f01be
Signed by: me
GPG key ID: 0104BC05F41B77B8
12 changed files with 29 additions and 2 deletions

View file

@ -24,6 +24,11 @@ class AccountsController < ApplicationController
format.rss do format.rss do
expires_in 1.minute, public: true expires_in 1.minute, public: true
if @account&.user&.setting_norss
@statuses = []
next
end
limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE
@statuses = filtered_statuses.without_reblogs.limit(limit) @statuses = filtered_statuses.without_reblogs.limit(limit)
@statuses = cache_collection(@statuses, Status) @statuses = cache_collection(@statuses, Status)

View file

@ -48,6 +48,7 @@ class Settings::PreferencesController < Settings::BaseController
:setting_system_font_ui, :setting_system_font_ui,
:setting_system_emoji_font, :setting_system_emoji_font,
:setting_noindex, :setting_noindex,
:setting_norss,
:setting_hide_followers_count, :setting_hide_followers_count,
:setting_aggregate_reblogs, :setting_aggregate_reblogs,
:setting_show_application, :setting_show_application,

View file

@ -6,6 +6,7 @@ module Settings
flavour flavour
skin skin
noindex noindex
norss
).freeze ).freeze
def initialize(object) def initialize(object)

View file

@ -35,6 +35,7 @@ class UserSettingsDecorator
user.settings['hide_followers_count'] = hide_followers_count_preference if change?('setting_hide_followers_count') user.settings['hide_followers_count'] = hide_followers_count_preference if change?('setting_hide_followers_count')
user.settings['flavour'] = flavour_preference if change?('setting_flavour') user.settings['flavour'] = flavour_preference if change?('setting_flavour')
user.settings['skin'] = skin_preference if change?('setting_skin') user.settings['skin'] = skin_preference if change?('setting_skin')
user.settings['norss'] = norss_preference if change?('setting_norss')
user.settings['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs') user.settings['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs')
user.settings['show_application'] = show_application_preference if change?('setting_show_application') user.settings['show_application'] = show_application_preference if change?('setting_show_application')
user.settings['advanced_layout'] = advanced_layout_preference if change?('setting_advanced_layout') user.settings['advanced_layout'] = advanced_layout_preference if change?('setting_advanced_layout')
@ -115,6 +116,10 @@ class UserSettingsDecorator
settings['setting_flavour'] settings['setting_flavour']
end end
def norss_preference
boolean_cast_setting 'setting_norss'
end
def skin_preference def skin_preference
settings['setting_skin'] settings['setting_skin']
end end

View file

@ -34,6 +34,7 @@ class Form::AdminSettings
show_domain_blocks show_domain_blocks
show_domain_blocks_rationale show_domain_blocks_rationale
noindex noindex
norss
outgoing_spoilers outgoing_spoilers
require_invite_text require_invite_text
captcha_enabled captcha_enabled
@ -62,6 +63,7 @@ class Form::AdminSettings
trendable_by_default trendable_by_default
trending_status_cw trending_status_cw
noindex noindex
norss
require_invite_text require_invite_text
captcha_enabled captcha_enabled
).freeze ).freeze

View file

@ -132,7 +132,7 @@ class User < ApplicationRecord
has_many :session_activations, dependent: :destroy has_many :session_activations, dependent: :destroy
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal, delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
:reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_media, :hide_followers_count, :reduce_motion, :system_font_ui, :noindex, :norss, :flavour, :skin, :display_media, :hide_followers_count,
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application, :expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
:advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images, :visible_reactions, :advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images, :visible_reactions,
:disable_swiping, :always_send_emails, :default_content_type, :system_emoji_font, :disable_swiping, :always_send_emails, :default_content_type, :system_emoji_font,

View file

@ -5,7 +5,9 @@
- if @account.user_prefers_noindex? - if @account.user_prefers_noindex?
%meta{ name: 'robots', content: 'noindex, noarchive' }/ %meta{ name: 'robots', content: 'noindex, noarchive' }/
%link{ rel: 'alternate', type: 'application/rss+xml', href: @rss_url }/ - if !@account.user&.setting_norss
%link{ rel: 'alternate', type: 'application/rss+xml', href: @rss_url }/
%link{ rel: 'alternate', type: 'application/activity+json', href: ActivityPub::TagManager.instance.uri_for(@account) }/ %link{ rel: 'alternate', type: 'application/activity+json', href: ActivityPub::TagManager.instance.uri_for(@account) }/
- @account.fields.select(&:verifiable?).each do |field| - @account.fields.select(&:verifiable?).each do |field|

View file

@ -29,6 +29,9 @@
.fields-group .fields-group
= f.input :timeline_preview, as: :boolean, wrapper: :with_label = f.input :timeline_preview, as: :boolean, wrapper: :with_label
.fields-group
= f.input :norss, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_norss.title'), hint: t('admin.settings.default_norss.desc_html')
.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

@ -10,6 +10,9 @@
.fields-group .fields-group
= f.input :setting_noindex, as: :boolean, wrapper: :with_label = f.input :setting_noindex, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_norss, as: :boolean, wrapper: :with_label
.fields-group .fields-group
= f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label, recommended: true = f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label, recommended: true

View file

@ -731,6 +731,9 @@ en:
default_noindex: default_noindex:
desc_html: Affects all users who have not changed this setting themselves desc_html: Affects all users who have not changed this setting themselves
title: Opt users out of search engine indexing by default title: Opt users out of search engine indexing by default
default_norss:
desc_html: Affects all users who have not changed this setting themselves
title: Opt users out of having an RSS feed of their public posts by default
discovery: discovery:
follow_recommendations: Follow recommendations follow_recommendations: Follow recommendations
preamble: Surfacing interesting content is instrumental in onboarding new users who may not know anyone Mastodon. Control how various discovery features work on your server. preamble: Surfacing interesting content is instrumental in onboarding new users who may not know anyone Mastodon. Control how various discovery features work on your server.

View file

@ -208,6 +208,7 @@ en:
setting_expand_spoilers: Always expand posts marked with content warnings setting_expand_spoilers: Always expand posts marked with content warnings
setting_hide_network: Hide your social graph setting_hide_network: Hide your social graph
setting_noindex: Opt-out of search engine indexing setting_noindex: Opt-out of search engine indexing
setting_norss: Opt-out of an RSS feed for your public posts
setting_reduce_motion: Reduce motion in animations setting_reduce_motion: Reduce motion in animations
setting_show_application: Disclose application used to send posts setting_show_application: Disclose application used to send posts
setting_system_font_ui: Use system's default font setting_system_font_ui: Use system's default font

View file

@ -31,6 +31,7 @@ defaults: &defaults
system_font_ui: false system_font_ui: false
system_emoji_font: false system_emoji_font: false
noindex: false noindex: false
norss: false
hide_followers_count: false hide_followers_count: false
flavour: 'glitch' flavour: 'glitch'
skin: 'default' skin: 'default'