|
|
@ -21,11 +21,13 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity |
|
|
|
def delete_note |
|
|
|
def delete_note |
|
|
|
return if object_uri.nil? |
|
|
|
return if object_uri.nil? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RedisLock.acquire(lock_options) do |_lock| |
|
|
|
|
|
|
|
delete_later!(object_uri) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@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? |
|
|
|
|
|
|
|
|
|
|
|
delete_later!(object_uri) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return if @status.nil? |
|
|
|
return if @status.nil? |
|
|
|
|
|
|
|
|
|
|
|
if @status.public_visibility? || @status.unlisted_visibility? |
|
|
|
if @status.public_visibility? || @status.unlisted_visibility? |
|
|
@ -68,4 +70,8 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity |
|
|
|
def payload |
|
|
|
def payload |
|
|
|
@payload ||= Oj.dump(@json) |
|
|
|
@payload ||= Oj.dump(@json) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def lock_options |
|
|
|
|
|
|
|
{ redis: Redis.current, key: "create:#{object_uri}" } |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|