From 890157170ef2954f0852c4964698ec2dd074f2e6 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Fri, 2 May 2025 22:40:42 -0700 Subject: [PATCH] oh right ruby uses double && for logical and --- app/helpers/json_ld_helper.rb | 6 +++--- app/services/activitypub/fetch_replies_service.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers/json_ld_helper.rb b/app/helpers/json_ld_helper.rb index e7fefa28bd..c4ba405d2c 100644 --- a/app/helpers/json_ld_helper.rb +++ b/app/helpers/json_ld_helper.rb @@ -232,8 +232,8 @@ module JsonLdHelper while collection.is_a?(Hash) items.concat(as_array(collection_page_items(collection))) - break if !max_items.nil? & items.size >= max_items - break if !max_pages.nil? & n_pages >= max_pages + break if !max_items.nil? && items.size >= max_items + break if !max_pages.nil? && n_pages >= max_pages collection = collection['next'].present? ? fetch_collection(collection['next'], reference_uri: reference_uri, on_behalf_of: on_behalf_of) : nil n_pages += 1 @@ -264,7 +264,7 @@ module JsonLdHelper # @return [Hash, nil] def fetch_collection(collection_or_uri, reference_uri: nil, on_behalf_of: nil) return collection_or_uri if collection_or_uri.is_a?(Hash) - return if !reference_uri.nil? & non_matching_uri_hosts?(reference_uri, collection_or_uri) + return if !reference_uri.nil? && non_matching_uri_hosts?(reference_uri, collection_or_uri) # NOTE: For backward compatibility reasons, Mastodon signs outgoing # queries incorrectly by default. diff --git a/app/services/activitypub/fetch_replies_service.rb b/app/services/activitypub/fetch_replies_service.rb index 30481de789..d89ad9cd5e 100644 --- a/app/services/activitypub/fetch_replies_service.rb +++ b/app/services/activitypub/fetch_replies_service.rb @@ -8,11 +8,11 @@ class ActivityPub::FetchRepliesService < BaseService def call(reference_uri, collection_or_uri, max_pages: 1, allow_synchronous_requests: true, request_id: nil) @reference_uri = reference_uri - return if !allow_synchronous_requests & !collection_or_uri.is_a?(Hash) + return if !allow_synchronous_requests && !collection_or_uri.is_a?(Hash) # if given a prefetched collection while forbidding synchronous requests, # process it and return without fetching additional pages - max_pages = 1 if !allow_synchronous_requests & collection_or_uri.is_a?(Hash) + max_pages = 1 if !allow_synchronous_requests && collection_or_uri.is_a?(Hash) @items, n_pages = collection_items(collection_or_uri, max_pages: max_pages, max_items: MAX_REPLIES, reference_uri: @reference_uri) return if @items.nil?