Respect user settings for RSS feeds

This commit is contained in:
nachtjasmin 2023-11-22 22:25:37 +01:00
parent 104981bbba
commit a23ca40a44
No known key found for this signature in database
1 changed files with 12 additions and 1 deletions

View File

@ -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