Merge pull request #1233 from hometown-fork/1232-rss-opt-out
Adding a `norss` user preference
This commit is contained in:
commit
29eb83d073
|
@ -45,6 +45,11 @@ class AccountsController < ApplicationController
|
|||
format.rss do
|
||||
expires_in 1.minute, public: true
|
||||
|
||||
if @account&.user&.setting_norss == true
|
||||
@statuses = []
|
||||
next
|
||||
end
|
||||
|
||||
limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE
|
||||
@statuses = filtered_statuses.without_reblogs.without_local_only.limit(limit)
|
||||
@statuses = cache_collection(@statuses, Status)
|
||||
|
|
|
@ -47,6 +47,7 @@ class Settings::PreferencesController < Settings::BaseController
|
|||
:setting_disable_swiping,
|
||||
:setting_system_font_ui,
|
||||
:setting_noindex,
|
||||
:setting_norss,
|
||||
:setting_theme,
|
||||
:setting_aggregate_reblogs,
|
||||
:setting_show_application,
|
||||
|
|
|
@ -5,6 +5,7 @@ module Settings
|
|||
DEFAULTING_TO_UNSCOPED = %w(
|
||||
theme
|
||||
noindex
|
||||
norss
|
||||
).freeze
|
||||
|
||||
def initialize(object)
|
||||
|
|
|
@ -31,6 +31,7 @@ class UserSettingsDecorator
|
|||
user.settings['disable_swiping'] = disable_swiping_preference if change?('setting_disable_swiping')
|
||||
user.settings['system_font_ui'] = system_font_ui_preference if change?('setting_system_font_ui')
|
||||
user.settings['noindex'] = noindex_preference if change?('setting_noindex')
|
||||
user.settings['norss'] = norss_preference if change?('setting_norss')
|
||||
user.settings['theme'] = theme_preference if change?('setting_theme')
|
||||
user.settings['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs')
|
||||
user.settings['show_application'] = show_application_preference if change?('setting_show_application')
|
||||
|
@ -102,6 +103,10 @@ class UserSettingsDecorator
|
|||
boolean_cast_setting 'setting_noindex'
|
||||
end
|
||||
|
||||
def norss_preference
|
||||
boolean_cast_setting 'setting_norss'
|
||||
end
|
||||
|
||||
def show_application_preference
|
||||
boolean_cast_setting 'setting_show_application'
|
||||
end
|
||||
|
|
|
@ -33,6 +33,7 @@ class Form::AdminSettings
|
|||
show_domain_blocks
|
||||
show_domain_blocks_rationale
|
||||
noindex
|
||||
norss
|
||||
require_invite_text
|
||||
).freeze
|
||||
|
||||
|
@ -48,6 +49,7 @@ class Form::AdminSettings
|
|||
trends
|
||||
trendable_by_default
|
||||
noindex
|
||||
norss
|
||||
require_invite_text
|
||||
).freeze
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class User < ApplicationRecord
|
|||
has_many :session_activations, dependent: :destroy
|
||||
|
||||
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal,
|
||||
:reduce_motion, :system_font_ui, :noindex, :theme, :display_media,
|
||||
:reduce_motion, :system_font_ui, :noindex, :norss, :theme, :display_media,
|
||||
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
|
||||
:advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images,
|
||||
:disable_swiping, :default_federation, :always_send_emails,
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
- if @account.user&.setting_noindex
|
||||
%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) }/
|
||||
|
||||
- if @older_url
|
||||
|
|
|
@ -91,6 +91,9 @@
|
|||
.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')
|
||||
|
||||
.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')
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
.fields-group
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
.fields-group
|
||||
= f.input :setting_noindex, as: :boolean, wrapper: :with_label
|
||||
|
||||
.fields-group
|
||||
= f.input :setting_norss, as: :boolean, wrapper: :with_label
|
||||
|
||||
.fields-group
|
||||
= f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label, recommended: true
|
||||
|
||||
|
|
|
@ -671,6 +671,9 @@ en:
|
|||
default_noindex:
|
||||
desc_html: Affects all users who have not changed this setting themselves
|
||||
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
|
||||
domain_blocks:
|
||||
all: To everyone
|
||||
disabled: To no one
|
||||
|
|
|
@ -170,6 +170,7 @@ en:
|
|||
setting_expand_spoilers: Always expand posts marked with content warnings
|
||||
setting_hide_network: Hide your social graph
|
||||
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_show_application: Disclose application used to send posts
|
||||
setting_system_font_ui: Use system's default font
|
||||
|
|
|
@ -30,6 +30,7 @@ defaults: &defaults
|
|||
show_application: true
|
||||
system_font_ui: false
|
||||
noindex: false
|
||||
norss: false
|
||||
theme: 'default'
|
||||
aggregate_reblogs: true
|
||||
advanced_layout: false
|
||||
|
|
Loading…
Reference in New Issue