1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-12 05:39:02 +09:00

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

This commit is contained in:
ThibG 2018-10-03 23:44:13 +02:00 committed by Eugen Rochko
parent 3b6ab82db7
commit ba444797d2
4 changed files with 6 additions and 2 deletions

View File

@ -26,7 +26,7 @@ class ActivityPub::Activity::Accept < ActivityPub::Activity
end
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
def relay_follow?

View File

@ -17,6 +17,8 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
end
def delete_note
return if object_uri.nil?
@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?

View File

@ -28,7 +28,7 @@ class ActivityPub::Activity::Reject < ActivityPub::Activity
end
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
def relay_follow?

View File

@ -19,6 +19,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
private
def undo_announce
return if object_uri.nil?
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?