Fix crash when likes or shares collections are not inlined (#34618)
This commit is contained in:
@@ -95,11 +95,11 @@ class ActivityPub::Parser::StatusParser
|
|||||||
end
|
end
|
||||||
|
|
||||||
def favourites_count
|
def favourites_count
|
||||||
@object.dig('likes', 'totalItems')
|
@object.dig('likes', 'totalItems') if @object.is_a?(Hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reblogs_count
|
def reblogs_count
|
||||||
@object.dig('shares', 'totalItems')
|
@object.dig('shares', 'totalItems') if @object.is_a?(Hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def quote_policy
|
def quote_policy
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||||||
type: 'Create',
|
type: 'Create',
|
||||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||||
object: object_json,
|
object: object_json,
|
||||||
}.with_indifferent_access
|
}.deep_stringify_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@@ -102,7 +102,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||||||
type: 'Create',
|
type: 'Create',
|
||||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||||
object: json,
|
object: json,
|
||||||
}.with_indifferent_access
|
}.deep_stringify_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@@ -1076,7 +1076,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||||||
type: 'Create',
|
type: 'Create',
|
||||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||||
object: Addressable::URI.new(scheme: 'bear', query_values: { t: token, u: object_json[:id] }).to_s,
|
object: Addressable::URI.new(scheme: 'bear', query_values: { t: token, u: object_json[:id] }).to_s,
|
||||||
}.with_indifferent_access
|
}.deep_stringify_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:object_json) do
|
let(:object_json) do
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ RSpec.describe ActivityPub::Parser::StatusParser do
|
|||||||
type: 'Create',
|
type: 'Create',
|
||||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||||
object: object_json,
|
object: object_json,
|
||||||
}.with_indifferent_access
|
}.deep_stringify_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:object_json) do
|
let(:object_json) do
|
||||||
|
|||||||
Reference in New Issue
Block a user