mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Do not rely on activity arriving exactly once after delete arrived (#4754)
This commit is contained in:
parent
a75aa62f5b
commit
c2980d5b17
@ -97,14 +97,7 @@ class ActivityPub::Activity
|
|||||||
end
|
end
|
||||||
|
|
||||||
def delete_arrived_first?(uri)
|
def delete_arrived_first?(uri)
|
||||||
key = "delete_upon_arrival:#{@account.id}:#{uri}"
|
redis.exists("delete_upon_arrival:#{@account.id}:#{uri}")
|
||||||
|
|
||||||
if redis.exists(key)
|
|
||||||
redis.del(key)
|
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_later!(uri)
|
def delete_later!(uri)
|
||||||
|
@ -5,13 +5,13 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
|
|||||||
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?
|
||||||
|
|
||||||
if status.nil?
|
|
||||||
delete_later!(object_uri)
|
delete_later!(object_uri)
|
||||||
else
|
|
||||||
|
return if status.nil?
|
||||||
|
|
||||||
forward_for_reblogs(status)
|
forward_for_reblogs(status)
|
||||||
delete_now!(status)
|
delete_now!(status)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user