From 94feb2b93ff1f381f8dba1ad361a2afd134f02a8 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Fri, 21 Oct 2022 18:48:22 +0900 Subject: [PATCH] Fix `FetchFeaturedCollectionService` spec (#19401) Regression from #19380 --- app/services/activitypub/fetch_featured_collection_service.rb | 3 +-- .../activitypub/fetch_featured_collection_service_spec.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/services/activitypub/fetch_featured_collection_service.rb b/app/services/activitypub/fetch_featured_collection_service.rb index 026fe24c5e..50a187ad98 100644 --- a/app/services/activitypub/fetch_featured_collection_service.rb +++ b/app/services/activitypub/fetch_featured_collection_service.rb @@ -43,8 +43,7 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService def process_note_items(items) status_ids = items.filter_map do |item| - type = item['type'] - next unless type == 'Note' + next unless item.is_a?(String) || item['type'] == 'Note' uri = value_or_id(item) next if ActivityPub::TagManager.instance.local_uri?(uri) diff --git a/spec/services/activitypub/fetch_featured_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_collection_service_spec.rb index f552b9dc07..e6336dc1b1 100644 --- a/spec/services/activitypub/fetch_featured_collection_service_spec.rb +++ b/spec/services/activitypub/fetch_featured_collection_service_spec.rb @@ -65,7 +65,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do stub_request(:get, 'https://example.com/account/pinned/3').to_return(status: 404) stub_request(:get, 'https://example.com/account/pinned/4').to_return(status: 200, body: Oj.dump(status_json_4)) - subject.call(actor) + subject.call(actor, note: true, hashtag: false) end it 'sets expected posts as pinned posts' do