1
0
Fork 0
forked from gitea/nas

Fix status reference load remote statuses

This commit is contained in:
KMY 2023-09-19 22:49:25 +09:00
parent d78281fb1d
commit 443e95d54b
2 changed files with 3 additions and 2 deletions

View file

@ -87,7 +87,7 @@ class ProcessReferencesService < BaseService
target_urls.map do |url|
status = ResolveURLService.new.call(url, on_behalf_of: @status.account, fetch_remote: @fetch_remote && @no_fetch_urls.exclude?(url))
@no_fetch_urls << url if !@fetch_remote && status.present?
@no_fetch_urls << url if !@fetch_remote && status.present? && status.local?
status
end
end

View file

@ -9,6 +9,7 @@ class ResolveURLService < BaseService
def call(url, on_behalf_of: nil, fetch_remote: true)
@url = url
@on_behalf_of = on_behalf_of
@fetch_remote = fetch_remote
if local_url?
process_local_url
@ -37,7 +38,7 @@ class ResolveURLService < BaseService
return account unless account.nil?
end
return unless @on_behalf_of.present? && [401, 403, 404].include?(fetch_resource_service.response_code)
return unless @on_behalf_of.present? && (!@fetch_remote || [401, 403, 404].include?(fetch_resource_service.response_code))
# It may happen that the resource is a private toot, and thus not fetchable,
# but we can return the toot if we already know about it.