From f337008819125d6ccb039220260b81117882a971 Mon Sep 17 00:00:00 2001 From: Daniel M Brasil Date: Wed, 23 Aug 2023 10:50:23 -0300 Subject: [PATCH] Fix timeout on invalid set of exclusionary parameters in `/api/v1/timelines/public` (#26239) --- app/models/public_feed.rb | 4 ++-- spec/requests/api/v1/timelines/public_spec.rb | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/public_feed.rb b/app/models/public_feed.rb index 1cfd9a500..c208d6f66 100644 --- a/app/models/public_feed.rb +++ b/app/models/public_feed.rb @@ -45,11 +45,11 @@ class PublicFeed end def local_only? - options[:local] + options[:local] && !options[:remote] end def remote_only? - options[:remote] + options[:remote] && !options[:local] end def account? diff --git a/spec/requests/api/v1/timelines/public_spec.rb b/spec/requests/api/v1/timelines/public_spec.rb index 7ed0fee2d..c43626240 100644 --- a/spec/requests/api/v1/timelines/public_spec.rb +++ b/spec/requests/api/v1/timelines/public_spec.rb @@ -56,6 +56,13 @@ describe 'Public' do it_behaves_like 'a successful request to the public timeline' end + context 'with local and remote params' do + let(:params) { { local: true, remote: true } } + let(:expected_statuses) { [local_status, remote_status, media_status] } + + it_behaves_like 'a successful request to the public timeline' + end + context 'with only_media param' do let(:params) { { only_media: true } } let(:expected_statuses) { [media_status] }