Fix handling of ActivityPub activities lacking some attributes (#8864)

main
ThibG 6 years ago committed by Eugen Rochko
parent 3b6ab82db7
commit ba444797d2

@ -26,7 +26,7 @@ class ActivityPub::Activity::Accept < ActivityPub::Activity
end end
def relay def relay
@relay ||= Relay.find_by(follow_activity_id: object_uri) @relay ||= Relay.find_by(follow_activity_id: object_uri) unless object_uri.nil?
end end
def relay_follow? def relay_follow?

@ -17,6 +17,8 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
end end
def delete_note def delete_note
return if object_uri.nil?
@status = Status.find_by(uri: object_uri, account: @account) @status = Status.find_by(uri: object_uri, account: @account)
@status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present? @status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present?

@ -28,7 +28,7 @@ class ActivityPub::Activity::Reject < ActivityPub::Activity
end end
def relay def relay
@relay ||= Relay.find_by(follow_activity_id: object_uri) @relay ||= Relay.find_by(follow_activity_id: object_uri) unless object_uri.nil?
end end
def relay_follow? def relay_follow?

@ -19,6 +19,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
private private
def undo_announce def undo_announce
return if object_uri.nil?
status = Status.find_by(uri: object_uri, account: @account) status = Status.find_by(uri: object_uri, account: @account)
status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present? status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present?

Loading…
Cancel
Save