From a23ca40a44eca67fb7209cafab9924c672552e3d Mon Sep 17 00:00:00 2001 From: nachtjasmin Date: Wed, 22 Nov 2023 22:25:37 +0100 Subject: [PATCH] Respect user settings for RSS feeds --- app/controllers/accounts_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 936973fb2..3d5e7f6fe 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -25,6 +25,12 @@ class AccountsController < ApplicationController format.rss do expires_in 1.minute, public: true + # Hometown: Do not display any entries in the RSS feed if it's disabled + 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.limit(limit) @statuses = cache_collection(@statuses, Status) @@ -48,7 +54,12 @@ class AccountsController < ApplicationController end def default_statuses - @account.statuses.where(visibility: [:public, :unlisted]) + # Hometown: local-only posts are not meant for RSS feeds, even if they are public. + if current_user.nil? + @account.statuses.without_local_only.where(visibility: [:public, :unlisted]) + else + @account.statuses.where(visibility: [:public, :unlisted]) + end end def only_media_scope