Compare commits

...

6 commits

17 changed files with 37 additions and 8 deletions

View file

@ -24,6 +24,11 @@ class AccountsController < ApplicationController
format.rss do
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
@statuses = filtered_statuses.without_reblogs.limit(limit)
@statuses = cache_collection(@statuses, Status)

View file

@ -65,6 +65,7 @@ class Api::V1::StatusesController < Api::BaseController
poll: status_params[:poll],
content_type: status_params[:content_type],
idempotency: request.headers['Idempotency-Key'],
local_only: status_params[:local_only],
with_rate_limit: true,
quote_id: status_params[:quote_id].presence
)
@ -133,6 +134,7 @@ class Api::V1::StatusesController < Api::BaseController
:scheduled_at,
:quote_id,
:content_type,
:local_only,
media_ids: [],
media_attributes: [
:id,

View file

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

View file

@ -197,10 +197,6 @@ export function submitCompose(routerHistory) {
return;
}
if (getState().getIn(['compose', 'advanced_options', 'do_not_federate'])) {
status = status + ' 👁️';
}
dispatch(submitComposeRequest());
// If we're editing a post with media attachments, those have not
@ -230,6 +226,7 @@ export function submitCompose(routerHistory) {
visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null),
language: getState().getIn(['compose', 'language']),
local_only: getState().getIn(['compose', 'advanced_options', 'do_not_federate']),
},
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),

View file

@ -206,7 +206,7 @@ function continueThread (state, status) {
map.set('in_reply_to', status.id);
map.update(
'advanced_options',
map => map.merge(new ImmutableMap({ do_not_federate: status.local_only }))
map => map.merge(new ImmutableMap({ do_not_federate: !!status.local_only }))
);
map.set('privacy', status.visibility);
map.set('sensitive', false);

View file

@ -6,6 +6,7 @@ module Settings
flavour
skin
noindex
norss
).freeze
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['flavour'] = flavour_preference if change?('setting_flavour')
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['show_application'] = show_application_preference if change?('setting_show_application')
user.settings['advanced_layout'] = advanced_layout_preference if change?('setting_advanced_layout')
@ -115,6 +116,10 @@ class UserSettingsDecorator
settings['setting_flavour']
end
def norss_preference
boolean_cast_setting 'setting_norss'
end
def skin_preference
settings['setting_skin']
end

View file

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

View file

@ -587,8 +587,10 @@ class Status < ApplicationRecord
def set_locality
if account.domain.nil? && !attribute_changed?(:local_only)
self.local_only = marked_local_only?
self.local_only = true if marked_local_only?
end
self.local_only = true if thread&.local_only? && self.local_only.nil?
self.local_only = reblog.local_only if reblog?
end
def set_conversation

View file

@ -132,7 +132,7 @@ class User < ApplicationRecord
has_many :session_activations, dependent: :destroy
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,
:advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images, :visible_reactions,
:disable_swiping, :always_send_emails, :default_content_type, :system_emoji_font,

View file

@ -183,6 +183,7 @@ class PostStatusService < BaseService
content_type: @options[:content_type] || @account.user&.setting_default_content_type,
rate_limit: @options[:with_rate_limit],
quote_id: @options[:quote_id],
local_only: @options[:local_only],
}.compact
end

View file

@ -5,7 +5,9 @@
- if @account.user_prefers_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) }/
- @account.fields.select(&:verifiable?).each do |field|

View file

@ -29,6 +29,9 @@
.fields-group
= 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
= 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
= 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

View file

@ -731,6 +731,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
discovery:
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.

View file

@ -208,6 +208,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

View file

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